Welcome! Log In Create A New Profile

Advanced

Re: nginx - php-fpm: access restrictions for some php pages

January 31, 2013 06:53AM
You mean like this?

location ~ ^\/some\/path\/(.*\.php)$ {
alias /some/path;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# Changes due to the alias declaration
fastcgi_param SCRIPT_FILENAME $document_root/$1;
fastcgi_param SCRIPT_NAME /$1;
allow 10.0.0.0/24;
deny all;
}

But now restriction rules are applied to all PHP files; instead I want to apply them just to some PHP files; should I use a nested location? something like this?

location ~ ^\/some\/path\/(.*\.php)$ {
alias /some/path;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
# Changes due to the alias declaration
fastcgi_param SCRIPT_FILENAME $document_root/$1;
fastcgi_param SCRIPT_NAME /$1;
location ~ \/phpinfo\.php$ {
allow 10.0.0.0/24;
deny all;
}
}
Subject Author Posted

nginx - php-fpm: access restrictions for some php pages

m.desantis January 31, 2013 06:22AM

Re: nginx - php-fpm: access restrictions for some php pages

Francis Daly January 31, 2013 06:40AM

Re: nginx - php-fpm: access restrictions for some php pages

m.desantis January 31, 2013 06:53AM

Re: nginx - php-fpm: access restrictions for some php pages

Francis Daly January 31, 2013 07:04AM

Re: nginx - php-fpm: access restrictions for some php pages

Francis Daly January 31, 2013 07:36AM

Re: nginx - php-fpm: access restrictions for some php pages

m.desantis January 31, 2013 09:12AM

Re: nginx - php-fpm: access restrictions for some php pages

Francis Daly January 31, 2013 02:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 128
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready