Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Restricting access to a folder

$
0
0
I had this issue as well, and the solution is to make sure your "allow / deny / auth" configuration block(s) always sit -above- your PHP & Static file configuration.

location ~* /admin {
auth_basic "Administrator Login";
auth_basic_user_file /path/to/.htpasswd
}

# Pass off php requests to Apache
location ~* \.php {
try_files $uri =404;
include /nginx/proxypass.conf;
proxy_pass http://127.0.0.1:80;
}

# Serve static files directly from nginx
location ~* \.(?:jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js)$ {
expires 365d;
etag on;
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>