I'm trying to get a password protected folder setup on my server (using nginx). I have tried it like so:
location / {
root /srv/www/steampunkjunkies.net/www;
index index.html index.htm index.php;
}
location /cgi-bin/admin {
satisfy any;
allow 81.174.134.133;
deny all;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/steampunkjunkies.net/htpasswd;
}
...but the problem with that, is that once you login - it doesn't execute this code a bit further down:
location ~ \.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/steampunkjunkies.net/www/cgi-bin/$fastcgi_script_name;
}
(so you just get a file download)
I'm at a bit of a loss as to what to do. Any suggestions? (this is my first time password protecting a folder on Nginx... but I've done it a ton of times on Apache)
UPDATE: As per a suggestion, I've now got:
location /cgi-bin/admin {
satisfy any;
allow 81.174.134.xxx;
deny all;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/mysite.net/htpasswd;
location ~ \.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/mysite.net/www/cgi-bin/$fastcgi_script_name;
}
}
The IP part works fine:
satisfy any;
allow 81.174.134.xxx;
deny all;
(if I change the IP to something that is not mine, then I get the popup... otherwise it lets me in ok)
The problem is with the popup password auth box. I enter the details (correctly), and it then goes away - but I'm then presented with a 403 Forbidden
error for some reason. Any ideas?