Nginx password protect directory
Posted: Wed Sep 09, 2015 1:06 pm
Hi,
I am trying to password protect a directory on my server with Nginx + Apache.
I have added the following lines to /home/admin/conf/web/nginx.conf inside the server { } definition.
The directory is now password protected, however php files inside the directory are downloaded instead of executed when accessing them.
What am I missing there to tell Nginx to forward php requests as it should? and by "as it should" I mean like it does in the default config for document root.
Thanks
I am trying to password protect a directory on my server with Nginx + Apache.
I have added the following lines to /home/admin/conf/web/nginx.conf inside the server { } definition.
Code: Select all
location ~ ^/secret {
root /home/admin/web/domain.com/public_html;
auth_basic "Administrator Login";
auth_basic_user_file /home/admin/web/domain.com/public_html/secret/.htpasswd;
What am I missing there to tell Nginx to forward php requests as it should? and by "as it should" I mean like it does in the default config for document root.
Thanks