Welcome! Log In Create A New Profile

Advanced

Question about FPM status/ping pages.

Posted by Juan Fco. Giordana 
Juan Fco. Giordana
Question about FPM status/ping pages.
January 14, 2011 09:52AM
Hello everyone,

I'm running nginx and php-fpm with a few virtual hosts on my development
environment (pretty much default configurations).

I'm playing with the FPM status and ping pages and I've found that these
pages are exposed on every virtual host that I have configured to pass
request to the FPM.

Is there a way to avoid that?

Regards.
任晓磊
Re: Question about FPM status/ping pages.
January 14, 2011 10:44AM
send your nginx.conf here


Ren Xiaolei



On Fri, Jan 14, 2011 at 10:50 PM, Juan Fco. Giordana
<juangiordana@gmail.com> wrote:
> Hello everyone,
>
> I'm running nginx and php-fpm with a few virtual hosts on my development
> environment (pretty much default configurations).
>
> I'm playing with the FPM status and ping pages and I've found that these
> pages are exposed on every virtual host that I have configured to pass
> request to the FPM.
>
> Is there a way to avoid that?
>
> Regards.
>
Juan Fco. Giordana
Re: Question about FPM status/ping pages.
January 14, 2011 12:14PM
On 01/14/2011 12:41 PM, 任晓磊 wrote:
> send your nginx.conf here

Helo Ren,

I don't have any fancy stuff in the configuration, just the FPM
listening on 127.0.0.1:9000 with pm.status_path = /status.

If the request ends with .php this will not happen since there wont be
match, but for most sites that have pretty URLs enabled /status should
show the status page.


Nginx stuff:

server {
....
# PHP-FPM status
location = /status {
access_log off;
allow 127.0.0.1;
deny all;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}

server {
....
location / {
try_files $uri $uri/ @fallback;
}

location @fallback {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
....
}


PHṔ-FPM stuff:
[global]
pid = /var/run/php-fpm.pid
error_log = /var/log/php-fpm/fpm_error.log
daemonize = no

[www]
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
user = apache
group = apache
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
pm.status_path = /status
ping.path = /ping
request_terminate_timeout = 120
request_slowlog_timeout = 10
slowlog = /var/log/php-fpm/$pool_slow.log
Re: Question about FPM status/ping pages.
January 14, 2011 12:20PM
Slightly off topic but the @fallback is redundant. You can replace it with /index.php - no need for a named location with no special behaviors or needs.

On Jan 14, 2011, at 9:11 AM, "Juan Fco. Giordana" <juangiordana@gmail.com> wrote:

> On 01/14/2011 12:41 PM, 任晓磊 wrote:
>> send your nginx.conf here
>
> Helo Ren,
>
> I don't have any fancy stuff in the configuration, just the FPM listening on 127.0.0.1:9000 with pm.status_path = /status.
>
> If the request ends with .php this will not happen since there wont be match, but for most sites that have pretty URLs enabled /status should show the status page.
>
>
> Nginx stuff:
>
> server {
> ...
> # PHP-FPM status
> location = /status {
> access_log off;
> allow 127.0.0.1;
> deny all;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
>
> }
>
> server {
> ...
> location / {
> try_files $uri $uri/ @fallback;
> }
>
> location @fallback {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME $document_root/index.php;
> include fastcgi_params;
> }
>
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
> include fastcgi_params;
> }
> ...
> }
>
>
> PHṔ-FPM stuff:
> [global]
> pid = /var/run/php-fpm.pid
> error_log = /var/log/php-fpm/fpm_error.log
> daemonize = no
>
> [www]
> listen = 127.0.0.1:9000
> listen.allowed_clients = 127.0.0.1
> user = apache
> group = apache
> pm = dynamic
> pm.max_children = 50
> pm.start_servers = 5
> pm.min_spare_servers = 5
> pm.max_spare_servers = 35
> pm.max_requests = 500
> pm.status_path = /status
> ping.path = /ping
> request_terminate_timeout = 120
> request_slowlog_timeout = 10
> slowlog = /var/log/php-fpm/$pool_slow.log
>
Juan Fco. Giordana
Re: Question about FPM status/ping pages.
January 14, 2011 12:30PM
On 01/14/2011 02:16 PM, Michael Shadle wrote:
> Slightly off topic but the @fallback is redundant. You can replace it
> with /index.php - no need for a named location with no special
> behaviors or needs.

It was merely an example only to show that I'm not doing anything weird
with complicated rewrites, etc. I have a few vhosts and it doesn't make
any sense to put the whole configs.

Also the fpm config is pretty clear on what to do when receiving a /ping
or /status request. I think that's the root of the problem.

I'd appreciate if anybody can confirm this behavior.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 228
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready