nginx password protecting - doing my head in!
I'm really at my witts end with the nginx config files
server {
listen 443;
#server_name site.net www.site.net;
server_name site.net;
access_log /srv/www/site.net/logs/access.log;
error_log /srv/www/site.net/logs/error.log;
root /srv/www/site.net/www;
ssl on;
ssl_certificate /srv/www/site.net/wildcard.site.net.crt;
ssl_certificate_key /srv/www/site.net/wildcard.site.net.key;
if ($http_host ~ "www.site.net") {
rewrite /(.*)$ https://site.net/$1 permanent;
}
location /cgi-bin/admin {
#root /srv/www/site.net/www;
#satisfy any;
deny all;
allow 81.174.134.111;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/site.net/htpasswd;
location ~ \.cgi$ {
try_files $uri =404;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www/cgi-bin/$fastcgi_script_name;
}
}
location /admin {
#satisfy any;
allow 81.174.134.133;
deny all;
#auth_basic "Administrator Login";
#auth_basic_user_file /var/www/site.net/htpasswd;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/site.net/www$fastcgi_script_name;
}
}
# other stuff here
}
81.174.134.111 is not my IP (I've changed it, so I should be getting the password request prompt, but I don't).
Any ideas what is up? ATM my admin panel is wide open, and I can't figure out how to password protect it
EDIT: Today is getting better and better! Now the friggin thing won't even load the website! I now get:
> Secure Connection Failed
An error occurred during a connection to steampunkjunkies.net. SSL received a record that exceeded the maximum permissible length. (Error code: sslerrorrxrecordtoo_long)
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
…which is insane, as it was working just fine with that configuration! I've trimmed it down to only:
server {
listen 80;
server_name www.site.net site.net;
access_log /srv/www/site.net/logs/access.log;
error_log /srv/www/site.net/logs/error.log;
root /srv/www/site.net/www;
}
server {
listen 443;
server_name www.site.net site.net;
access_log /srv/www/site.net/logs/access.log;
error_log /srv/www/site.net/logs/error.log;
root /srv/www/site.net/www;
}
..rebooted nginx, and its still not loading anything :S
TIA
Andy
4 Replies
Not ideal, as I'm having to pay for 2 individual linodes… but, at the same time its good - as it means I can do a "live" compare of the files (copying the files direct from live, and then comparing the live to dev - to see which files have changed). Hopefully this'll help with going live with new features now
Cheers
Andy
diff
on the files in there, to see what is different to the live (so I know what I've got to change on live, i.e templates, javascripts, css files, images etc). Should make porting changes over a lot easier!
Cheers
Andy