I need to secure a particular folder in a Ubuntu Server 12.04 running Nginx.
I followed this tutorial: http://nginxlibrary.com/password-protect-a-directory/ and many others like it.
I created a file called .htpasswd using apache utils and put it in /etc/nginx/passwords
Then went to server block in the configuration file and put
location /var/www/mywebsitedir.com/folderthatneedsprotection {
auth_basic "Restricted Area";
auth_basic_user_file /etc/nginx/passwords/.htpasswd;
}
I also tried many variations of the location directives such as using wild cards ^~ etc and it still does not work. I really need to password protect a directory, but it does not seem to work! Any help is greatly appreciated.