Nginx, as one of light web server software, is awesome. It has the ability to protect whole or parts of your web application via http authentication. It can be set up with ease. Be careful with the path of your auth user file. Try to change it to the absolute path if your pages drop into 500 Internal Server Error.
syntax: auth_basic_user_file the_file
context: http, server, location, limit_except
This directive sets the htpasswd filename for the authentication realm. Since version 0.6.7 the filename path is relative to directory of nginx configuration file nginx.conf, but not to nginx prefix directory.
The format of file is the following:
Passwords must be encoded by function crypt(3). You can create the password file with the htpasswd program from Apache.