Protecting a directory in nginx
Monday 19, December 2011

Just add the following lines to your nginx.conf file:

location  /mydirectory  {
  auth_basic            "Restricted";
  auth_basic_user_file  htpasswd;
}

The htpasswd could be create with the following command:

$ htpasswd -c htpasswd myuser

To see how to do that with Apache take a look here.

Tags

Buy me a coffee!! Coffee cup

Advertisment