Hi,
I've recently switched from apache to nginx and I'm still struggling with a few minor details:
I dont want to log any static files for a particular vhost and I want to restrict the access to a particular directory and all subdirectories within it. So I have these lines in my vhost configuration file:
# Static files logging off
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml|html|txt)$ {
access_log off;
expires max;
}
# Restrict access to admin directory
location /admin/ {
auth_basic "Restricted Area";
auth_basic_user_file /etc/nginx/secret/admin.secret;
....
....
}
Access restriction works if I try to access http://example.com/admin/subdir/
but my problem is that when accessing e.g. http://example.com/admin/subdir/index.html I am not asked for any password and the file is displayed directly this is also valid for e.g. http://example.com/admin/subdir/picture.jpg
As soon as I remove the html and the jpg part for the static files logging segment I am asked for a password in both cases.
How do I have to change my configuration so that I do not log the files but am still asked for a password for any of those files within the access restricted folder?
Thanks for any help
I've recently switched from apache to nginx and I'm still struggling with a few minor details:
I dont want to log any static files for a particular vhost and I want to restrict the access to a particular directory and all subdirectories within it. So I have these lines in my vhost configuration file:
# Static files logging off
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml|html|txt)$ {
access_log off;
expires max;
}
# Restrict access to admin directory
location /admin/ {
auth_basic "Restricted Area";
auth_basic_user_file /etc/nginx/secret/admin.secret;
....
....
}
Access restriction works if I try to access http://example.com/admin/subdir/
but my problem is that when accessing e.g. http://example.com/admin/subdir/index.html I am not asked for any password and the file is displayed directly this is also valid for e.g. http://example.com/admin/subdir/picture.jpg
As soon as I remove the html and the jpg part for the static files logging segment I am asked for a password in both cases.
How do I have to change my configuration so that I do not log the files but am still asked for a password for any of those files within the access restricted folder?
Thanks for any help