Protecting a folder on nginx
|| how to protecting a folder with password on nginx
| generate htpasswd password using perl
# perl -le 'print crypt("yourpassword", "salt")'
| make htpasswd
# vi /etc/nginx/conf/htpasswd username:eNcRyPtIoNpAsSwOrd:justcomment
| setup on nginx.conf / vhost
# vi /etc/nginx/nginx.conf
# add line like this
location ^~/afoldername {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf/htpasswd;
}
| restarting nginx
# /etc/init.d/nginx restart