addis_a
1
Hello,
i have a URL like
https://example.com/foo/doc/bar/filename.txt
I want to deny access to all files and folders in /doc/…
and try
location ~ ^/foo/(doc|etc|lib|log|sbin|var/cache|var/lib|var/log)/ {
deny all;
}
I does not work, i can download the file above.
How can please help?
Thanks!
On Fri, Feb 13, 2015 at 02:20:29PM +0100, basti wrote:
https://example.com/foo/doc/bar/filename.txt
location ~ ^/foo/(doc|etc|lib|log|sbin|var/cache|var/lib|var/log)/ {
deny all;
}
http://nginx.org/r/location
One request is handled in one location.
Which one location in your config will handle the request
/foo/doc/bar/filename.txt ?
If it is the one you show, you will get http 403.
f
Francis D. [email protected]
basti Wrote:
Hello,
i have a URL like
https://example.com/foo/doc/bar/filename.txt
I want to deny access to all files and folders in /doc/…
and try
location ~ ^/foo/(doc|etc|lib|log|sbin|var/cache|var/lib|var/log)/ {
deny all;
}
Maybe something like:
map $uri $locn {
default 0;
~/foo/ 1;
~/doc/ 1;
}
location / {
if ($locn) { return 404; }
}
Posted at Nginx Forum: