directives:
auth_basic [
auth_basic_user_file path/to/file
htpasswd file format:
# comment
login:password
Command htpasswd should be used with option -d , because nginx supports crypt() algorithm only.
Example:
htpasswd -c -d /etc/nginx/htpasswd asalnikov
nginx.conf part:
location /
{
auth_basic "closed site";
auth_basic_user_file /etc/nginx/htpasswd;
...
}
If you use passenger, make sure to add passenger_enabled on; inside the location block.
ReplyDelete