Create PHP-FPM Status Page for nginx+php-fpm in directadmin

rnc

Verified User
Joined
Jun 8, 2013
Messages
72
Hello
i want to add php-fpm status page to one of my servers user domain
i used this guide

and added
pm.status_path = /status

to
File: /usr/local/php55/etc/php-fpm.conf

and also


location ~ ^/(fpmstatus|ping)$ {
access_log off;
allow 127.0.0.1;
allow 1.2.3.4; ### MY workstation Ip Address
deny all;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}

to user account nginx configuration file lcated at

/usr/local/directadmin/data/users/admin/php/php-fpm55.conf

but i get error
502 Bad Gateway
nginx

when i Brose to domain.com/fpmstatus page !


i think something is wrong with my php-fpm pass parameters

anyone have any idea ?
 
You should add 1st block of the code to custom PHP-FPM configuration, and the 2nd one - to custom nginx (not php-fpm55) configuration. Please use DirectAdmin GUI to do that ("Customize HTTPd configuration" feature on admin level).
 
hello
thnaks for reply

i dont think this is related to the way that i add config

whether i add it to related v hsot nginx configurtion file in server block and php-fpm related file in user php fpm
or add it trough directadmin gui
they both do same job on same file

the main problem was the fastcgi params and fastcgi pass

that should be
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/usr/local/php55/sockets/webapps.sock;




that problem solved !

no 404 or 502 appear !

but just blank screen without any single error on nginx error log ( server global or user specefic log )


any idea ?
 
i dont think this is related to the way that i add config

It's related, because in your first post you said that you added NGINX location block to "/usr/local/directadmin/data/users/admin/php/php-fpm55.conf", which is a config file of PHP-FPM, and not NGINX.
 
Hello
i cant correct that by edit ! i dont know why
but there is the correct POST

but i still have problem as i mentioned in my previous post


i want to add php-fpm status page to one of my servers user domain
i used this guide

and added
pm.status_path = /status

to
File: /usr/local/php55/etc/php-fpm.conf
/usr/local/directadmin/data/users/admin/php/php-fpm55.conf

and also


location ~ ^/(fpmstatus|ping)$ {
access_log off;
allow 127.0.0.1;
allow 1.2.3.4; ### MY workstation Ip Address
deny all;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}

to user account nginx configuration file lcated at

/usr/local/directadmin/data/users/admin/nginx.conf

but i get error
502 Bad Gateway
nginx

when i Brose to domain.com/fpmstatus page !


i think something is wrong with my php-fpm pass parameters

anyone have any idea ?
 
Ah, I see that you usefastcgi_pass 127.0.0.1:9000. Please change it to point to php-fpm user's socket file.
 
Ah, I see that you usefastcgi_pass 127.0.0.1:9000. Please change it to point to php-fpm user's socket file.

Hello and thanks for reply
yes
as i said in my previous post


the main problem was the fastcgi params and fastcgi pass

that should be
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/usr/local/php55/sockets/webapps.sock;

but now there is a blank screen without any single error on PHP or nginx error files
 
A little late but might help someone...

I have been searching for an easyway to have this feature as it is a little similar to the apache status page of old and helps with debugging the php-fpm high CPU / memory usage etc.

For a fully working solution you can do the following:

  • Go to Custom HTTPD Configuration
  • Select the php-fpm version you are running for the domain you want to see the status
  • Under the |Custom2| section add the line "pm.status_path = /status" (without quotes), click Save and go back to the Custom HTTPD Configuration Page
  • Click on the Domain name to edit the Nginx configuration file adding the following to the top(modify where necessary):

Code:
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
allow 123.123.123.123; ### IP Address used to access the page
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/usr/local/php53/sockets/example.sock;
}

With the above you will need to:

  • Edit the IP address to allow your current internet IP address
  • Change the php53 to the version you are using eg: php54 php55 php56
  • Change example.sock to the user in which the website is running under
  • Once this is done click the Save button
  • Return to the Custom HTTPD Configuration Section and press the "./build rewrite_confs" button to apply the changes you have made.

You may have to restart the nginx and php-fpm service if the rewrite_confs does not to this for you.

Afterwards you will now be able to access the various status pages from the allowed IP address(es). A brief run down:

Examples for summary status page:

http://example.com/status
http://example.com/status?json
http://example.com/status?html
http://example.com/status?xml

Example for detailed status page:

http://example.com/status?full
http://example.com/status?json&full
http://example.com/status?html&full
http://example.com/status?xml&full

I hope this helps someone, like myself, with a full explanation on how to integrate the very useful status page into your existing directadmin, nginx, php-fpm installation that will persist across configuration rewrites and updates.
 
status page on server level

Hello,
thanks for the guide. But can't we just have a status page on server level with nginx+php-fpm setup aside from the one that comes with nginx-plus?
This one is on user level, which makes things so difficult !!


I have been searching for an easyway to have this feature as it is a little similar to the apache status page of old and helps with debugging the php-fpm high CPU / memory usage etc.

For a fully working solution you can do the following:

  • Go to Custom HTTPD Configuration
  • Select the php-fpm version you are running for the domain you want to see the status
  • Under the |Custom2| section add the line "pm.status_path = /status" (without quotes), click Save and go back to the Custom HTTPD Configuration Page
  • Click on the Domain name to edit the Nginx configuration file adding the following to the top(modify where necessary):

Code:
location ~ ^/(status|ping)$ {
access_log off;
allow 127.0.0.1;
allow 123.123.123.123; ### IP Address used to access the page
deny all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/usr/local/php53/sockets/example.sock;
}

With the above you will need to:

  • Edit the IP address to allow your current internet IP address
  • Change the php53 to the version you are using eg: php54 php55 php56
  • Change example.sock to the user in which the website is running under
  • Once this is done click the Save button
  • Return to the Custom HTTPD Configuration Section and press the "./build rewrite_confs" button to apply the changes you have made.

You may have to restart the nginx and php-fpm service if the rewrite_confs does not to this for you.

Afterwards you will now be able to access the various status pages from the allowed IP address(es). A brief run down:

Examples for summary status page:

http://example.com/status
http://example.com/status?json
http://example.com/status?html
http://example.com/status?xml

Example for detailed status page:

http://example.com/status?full
http://example.com/status?json&full
http://example.com/status?html&full
http://example.com/status?xml&full

I hope this helps someone, like myself, with a full explanation on how to integrate the very useful status page into your existing directadmin, nginx, php-fpm installation that will persist across configuration rewrites and updates.
 
The code should be added in the nginx.conf customization for your domain. I allow all. I don't need to let it like that. So, I just copy and paste this code whenever I need it.

Code:
location ~ ^/(status|ping)$ {
access_log off;
allow all;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/usr/local/php80/sockets/admin.sock;
}

1632512248923.png
*


Then, I go to a browser and I add /status
1632512364439.png


When I wanted to switch my directadmin php fpm configuration from ondemand to dynamic/ Anyway, i can use one php version for ondemand and one php version for dynamic.
I add the following code to php-fpm 8.0 CUSTOM2

Code:
pm = dynamic
pm.max_children = 20
pm.start_servers = 16
pm.min_spare_servers = 8
pm.max_spare_servers = 16
pm.max_requests = 1000
pm.process_idle_timeout = 10
pm.status_path = /status

1632512549665.png


After the change, I click on ./build rewrite_confs
 
Back
Top