Deny access to one file

Emers emers at euro-net.pl
Sun Jan 20 13:17:52 MSK 2008


Igor Sysoev wrote:
> On Thu, Jan 17, 2008 at 08:23:59AM +0100, Emers wrote:
> 
>> Dave Cheney wrote:
>>> Try
>>>
>>> location = ' /includes/confirm_register.php' {
> 
>>>    deny    192.168.0.0/16;
>>>    deny    123.123.123.0/24;
>>>    allow   all;
>>> }
>> Nope. Doesnt work.
> 
> -  location = ' /includes/confirm_register.php' {
> +  location = /includes/confirm_register.php {

This solution works only for static files. PHP script is forbided for 
deny hosts, allow hosts get source of confirm_register.php file.
Adding sublocation for passing php files solve my problem.

My location is as follow:

location ^~ /includes/confirm_register.php {
	deny    192.168.0.0/24;
	deny	123.123.123.0/24;
         allow   all;
         location ~ .*\.php?$ {
             include /etc/nginx/fastcgi.conf;
             fastcgi_pass  unix:/tmp/fcgi.socket;
             fastcgi_index index.php;
	}
}

Thank you for not helping me quickly, and leting me figure it out by myself.

-- 
Regards.

Emers





More information about the nginx mailing list