block access to a file !!

Francis Daly francis at
Wed Jun 6 14:31:53 UTC 2012

On Wed, Jun 06, 2012 at 09:50:57AM -0400, torajx wrote:
> thank you for reply..
> i change it to "location = /admin.php "
> and move it above the "location ~ \.php$ "

Either use something like "location = /admin.php", or maybe reorder to
regex locations (with ~) so they match in the order you want.

You've done both. That's ok, but unnecessary.

> it blocks other IPs but give file not found error for allowed Ips..
> the last time I added root to admin.php location the browser promot me
> to download admin.php..
> what can I do now ?

You will (probably) want to repeat your fastcgi_pass and other fastcgi_*
config lines inside the new location block. One request is handled by
one location.

Do that.

Francis Daly        francis at

More information about the nginx mailing list