I am running magento on an nginx server. I decided to lock down a folder full of .php files using auth_basic and a htpasswd file. Without the auth, the php pages render and work fine. But after forcing the auth, when I go to the page I get the login prompt (which is good), I log in, and then the browser tries to download the php file. It refuses to render it. This is across multiple browsers (chrome, firefox, opera, ie). Any idea what I need to do to be able to have it password protected but still working? Thanks!
EDIT: .conf file auth setup
location ~^ /FOLDER/ {
auth_basic "Restricted";
auth_basic_user_file /path/to/htpasswd/;
}
Nginx will not 'jump' to another location, so you have to add 'proxying' to the php interpreter's process inside of your protected location:
location ~^ /FOLDER {
auth_basic "Restricted";
auth_basic_user_file /path/to/htpasswd/;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
}
Change port or config to whatever you have in the other location of your config. There is another way with named locations, but I do not think that you need it here.