swiss_blade
swiss_blade

Reputation: 541

PHP-FPM status page on Plesk + NGINX proxy

I am trying to enable the PHP-FPM status page on a vhost running under Plesk 17 using apache to serve PHP files, but with nginx as a proxy. I have enabled the status page for php, but I am having trouble with the nginx rules. Here is my additional nginx directives so far

location /fpm-status {
    include fastcgi.conf;
    fastcgi_pass unix:/var/www/vhosts/system/fifthelement.gr/php-fpm.sock;
    access_log off;
    allow all;
}

However, this (and some other directives I tried too) does not seem to work since I am getting a "File not found" error while visiting the status page.

Has anyone managed to do this?

Thanks!

Upvotes: 1

Views: 2676

Answers (2)

Bogdan
Bogdan

Reputation: 2042

The following works for me using PLESK 17 on CentOS 7 (inside Plesk > Websites & Domains > [yourdomainname] > Hosting Settings I have: run PHP as FPM application served by nginx)

Steps to get a working /status page

  1. Create/edit /var/www/vhosts/system/[yourdomainname]/conf/php.ini adding the following

    [php-fpm-pool-settings]
    pm.status_path = /status
    
  2. Inside Plesk > Websites & Domains > [yourdomainname] > Apache & nginx Settings add to Additional nginx directives the following

    location ~ ^/status$ {
        allow 127.0.0.1;
        allow [yourip];
        deny all;
        fastcgi_split_path_info ^((?U).+\\.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass "unix:///var/www/vhosts/system/[yourdomainname]/php-fpm.sock";
        include /etc/nginx/fastcgi.conf;
    }
    
  3. Reload Plesk PHP configuration

    /usr/local/psa/bin/php_settings -u
    

Then you should be able to access http://[yourdomainname]/status and http://[yourdomainname]/status?full

Upvotes: 0

UFHH01
UFHH01

Reputation: 543

the status-page expects the ports 80/443 for apache2, but in combination with Plesk, your apache2 - webserver listens on the ports 7080/7081 and nginx on the ports 80/443.

Pls. use for example

<IfModule mod_status.c>
	Listen 8005
<Location /apache-status>
	SetHandler server-status
	Order deny,allow
	Deny from all
	Allow from 127.0.0.1 ::1
</Location>
	ExtendedStatus On
</IfModule>

inside your server.conf, httpd.conf and call the page from your SSH - command line with for example "lynx"

lynx http://localhost:8005/apache-status

For your PHP-FPM - status - page, pls. locate the corresponding "fifthelement.gr.conf" ( example for the usage of the standart PHP5 - Handler from your vendor on your domain: "/etc/php5/fpm/pool.d/fifthelement.gr.conf" ) and define inside:

pm.status_path = /fpm-status

Afterwards, modify your additional nginx directive to for example:

location /fpm-status {
	include fastcgi.conf;
	allow 127.0.0.1;
	deny all;
	fastcgi_pass unix:/var/www/vhosts/system/fifthelement.gr/php-fpm.sock;
	access_log off;
	}

... and again, you might use "lynx" with the example - command:

lynx http://localhost/fpm-status

Upvotes: 3

Related Questions