Welcome! Log In Create A New Profile

Advanced

deny directory abc denies directory abcd etc

Posted by edtaa 
edtaa
deny directory abc denies directory abcd etc
August 07, 2012 07:40PM
Hi
I'm new to this forum so I hope this hasn't come up before I didn't find
anything by searching.

I'm using the following to block access to multiple directories:

location ~ /(abc|def|ghi) { deny all; access_log off; log_not_found
off; return 404;}

The problem I find is that if there is a file or directory beginning
with the same three characters, it too is blocked. So, for example, a
directory or file named abcd would also be blocked.

Is there a solution to this or is my code incorrect?

Thanks

Terry

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,229406,229406#msg-229406

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Cliff Wells
Re: deny directory abc denies directory abcd etc
August 07, 2012 09:10PM
On Tue, 2012-08-07 at 13:30 -0400, edtaa wrote:
> Hi
> I'm new to this forum so I hope this hasn't come up before I didn't find
> anything by searching.
>
> I'm using the following to block access to multiple directories:
>
> location ~ /(abc|def|ghi) { deny all; access_log off; log_not_found
> off; return 404;}
>

Regex locations take precedence over literal locations. Change your
regex to this:

location ~ /(abc|def|ghi)/?$

Cliff


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login