Restrict/Deny access to all paths starting with _

Marcus Clyne ngx.eugaia at gmail.com
Fri Jan 22 13:44:14 MSK 2010


Hi,

Smrchy wrote:
> Hi,
> this is probably a noob question but i'm wondering what would be the 
> best way to
>
> allow access to a directory e.g.:
>
> location /foo {
>    ...
> }
>
> this will allow access to
>
> /foo
> /foo/bar
> /foo/bar/somefile.txt
>
> But now i want to deny access to everything starting with /foo/_
location   /foo {
    ...
}

location   ^~   /foo/_ {
    return   403;
}

should do the trick (and should be the most efficient I believe).

Marcus.



More information about the nginx mailing list