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