Nginx - andreydiveev/wiki GitHub Wiki

Gen pass:

sh -c "echo -n 'exampleuser:' >> /etc/nginx/.htpasswd"
sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"

Nginx basic http auth:

# apt-get install apache2-utils
# htpasswd -c /etc/nginx/.htpasswd exampleuser

location / {
    auth_basic "Please, sign in:";
    auth_basic_user_file /etc/nginx/.htpasswd;
}

# service nginx restart