EasyApache 4 PHP-FPM Status Page

jasperthedummy

Registered
Nov 13, 2016
3
0
1
SIngapore
cPanel Access Level
Root Administrator
Hi there,

I am wondering if there is a way for me to access the PHP-FPM status page of any particular PHP-FPM pool within the WHM interface just like how we can access the Apache Status page as easily within WHM?

I notice that pm.status_path is currently pointing to /status in all my config files of all my pools. /opt/cpanel/ea-php54/root/etc/php-fpm.d/[domain].conf :
Code:
pm.status_path = /status
Allowing for this will enable me to easily monitor the usage of all my pools:
Code:
pool:                 www
process manager:      dynamic
start time:           17/May/2016:13:54:02 +0530
start since:          886617
accepted conn:        1619617
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       28
active processes:     2
total processes:      30
max active processes: 31
max children reached: 0
slow requests:        0
An added bonus will be if the page can show with the /status?full option to allow me to view more details on the processes within the pool.
 

dhultin

Registered
Feb 22, 2015
3
1
3
cPanel Access Level
DataCenter Provider
I was messing around with this today and this is a pretty simple thing to do. I added this to my domains configuration in httpd.conf with Easy Apache4. You could likely make an include file for this instead. The proxy_fcgi_module section already exists. I added <LocationMatch>

<IfModule proxy_fcgi_module>
<FilesMatch \.(phtml|php[0-9]*)$>
SetHandler proxy:unix:/opt/cpanel/ea-php56/root/usr/var/run/php-fpm/c71e80857422fac3e2c4db73c2eb615bedb15678.sock|fcgi://disc4life.com/
</FilesMatch>
<LocationMatch "/(ping|status)">
order deny,allow
deny from all
#allow from 10.20.4.4
allow from 10.20.4.0/22
SetHandler proxy:unix:/opt/cpanel/ea-php56/root/usr/var/run/php-fpm/c71e80857422fac3e2c4db73c2eb615bedb15678.sock|fcgi://disc4life.com/
</LocationMatch>
</IfModule>

Now I can visit /status and /status?full or /ping on my domain and it shows the FPM status for my domain. Rules are here to deny / allow access as well based on IP. Good luck.
 
  • Like
Reactions: cPanelMichael

Alesak

Registered
Oct 5, 2018
1
3
3
Sydney
cPanel Access Level
Root Administrator
There is pretty easy way to achieve this without much configuration:
  1. add or change status path to end with .phtml like, you may add pm_status_path: /status.phtml to /var/cpanel/ApachePHPFPM/system_pool_defaults.yaml
  2. than rebuild FPM configuration files with /scripts/php_fpm_config --rebuild
  3. than create file status.phtml in each website root with simple content like <html></html> ,file must exist so the request is forwarded to FPM
  4. to finish just restart PHP-FPM daemons
Now you will be able to see status page like http://example/status.phtml