block access to a file !!

Francis Daly francis at daoine.org
Wed Jun 6 13:41:08 UTC 2012


On Wed, Jun 06, 2012 at 09:22:50AM -0400, torajx wrote:

Hi there,

> it must be a piece of cake but i can not find a soloution...
> 
> the problem is " location admin.php". you can check it below...

No, the problem is "location ~ admin.php" coming after "location ~
\.php$". The exact characters matter.

http://nginx.org/r/location

> i just want to allow access to admin.php to some ip address and deny
> others.

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

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.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list