Deny access per extension in multiple locations
Francis Daly
francis at daoine.org
Fri Oct 8 02:05:12 MSD 2010
On Thu, Oct 07, 2010 at 12:07:59PM -0400, nfn wrote:
Hi there,
> How can I join this in one line to deny access in multiple folders for
> these extensions?
>
> I was trying this without success:
>
> location ~ /(uploads/|docs/|pdfs/)*\.(php|cgi|pl|php3|php4|php5)$ {
> root /srv/www/portaldasviagens.com/public;
> deny all;
> }
Turn on "error_log" with "debug", then try to access one of the urls
you want to have denied. Look for the log lines with "test location:"
and "using configuration". That will tell you which location block is
being used for each request.
I suspect that the above regular expression does not match the locations
you want it to match. Specifically, the "*" probably wants a "." before
it.
Good luck,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list