Home / Linux / How to Enable and Monitor PHP-FPM Status in Nginx
1539345643 how to enable and monitor php fpm status in nginx - How to Enable and Monitor PHP-FPM Status in Nginx

How to Enable and Monitor PHP-FPM Status in Nginx

How to Enable and Monitor PHP-FPM Status in Nginx

PHP-FPM (FastCGI Process Manager) is another PHP FastCGI implementation that incorporates quite a few further options helpful for web pages of any dimension, in particular websites that obtain prime site visitors.

It is usually used in the LEMP (Linux Nginx MySQL/MariaDB PHP) stack; Nginx makes use of PHP FastCGI for serving dynamic HTTP content material on a community. It is getting used to serve thousands and thousands of PHP requests for loads of web pages on internet servers on the net.

Read Also: How to Enable NGINX Status Page

One of the helpful options of php-fpm is the built-in standing web page, which mean you can observe its well being. In this newsletter, we can display how to allow the PHP-FPM standing web page on Linux.

How to Enable PHP-FPM Status Page in Linux

First open the php-fpm configuration document and allow the standing web page as proven.

$ sudo vim /and many others/php-fpm.d/www.conf 
OR
$ sudo vim /and many others/php/7.2/fpm/pool.d/www.conf	#for PHP variations five.6, 7.zero, 7.1

Inside this document, in finding and uncomment the variable pm.status_path = /standing as proven in the screenshot.

Enable PHP-FPM Status PageEnable PHP-FPM Status Page

Enable PHP-FPM Status Page

Save the adjustments and go out the document.

Next, take a look at that the PHP-FPM configuration document for any mistakes by way of working the command underneath.

$ sudo php-fpm -t
OR
$ sudo php7.2-fpm -t
Check PHP-FPM Configuration FileCheck PHP-FPM Configuration File

Check PHP-FPM Configuration File

Then restart the PHP-FPM carrier to observe the new adjustments.

$ sudo systemctl restart php-fpm
OR
$ sudo systemctl restart php7.2-fpm

Next, edit your default server block (digital host) configuration document and upload the location block underneath in it. For example at the take a look at gadget, the default server block’s config document is /and many others/nginx/conf.d/default.conf, for the web page take a look at.lab.

$ sudo vim /and many others/nginx/conf.d/default.conf 

Here is the location block to be added. In this config, we’ve got best allowed get right of entry to to PHP-FPM procedure standing inside the localhost the usage of the directive permit 127.zero.zero.1 for safety causes.

location ~ ^/(standing|ping)$ 

Save the document and shut it.

Then restart the Nginx server to observe the above adjustments.

$ sudo systemctl restart nginx

Now open a browser and kind the URL http://test.lab/status to view your PHP-FPM procedure standing.

View PHP-FPM Status PageView PHP-FPM Status Page

View PHP-FPM Status Page

Alternatively, use the curl program as follows, the place the -L flag specifies the positioning of the web page.

$ curl -L http://test.lab/status

By default, the standing web page best prints out a abstract or brief standing. To view standing for every pool procedure, move “full” in the question string, as an example:

http://www.foo.bar/status?full

You can outline the output structure (JSON, HTML or XML) as proven.

http://www.foo.bar/status?json&full
http://www.foo.bar/status?html&full
http://www.foo.bar/status?xml&full

Below are the values returned in the php-fpm complete standing, for every procedure:

  • pid – PID of the method.
  • state procedure standing (idle, working, and many others.).
  • get started time – date and time the method has began.
  • get started since – choice of seconds because the procedure has began.
  • requests – choice of requests the method has served.
  • request period – period in µs of the requests.
  • request means – request means (GET, POST, and many others.).
  • request URI – request URI with the question string.
  • content material period – content material period of the request (best with POST).
  • person – person (PHP_AUTH_USER) (or ‘-‘ if no longer set).
  • script – major script referred to as (or ‘-‘ if no longer set).
  • final request cpu – %cpu the final request ate up (observe that it’s all the time zero if the method isn’t in Idle state).
  • final request reminiscence – max quantity of reminiscence the final request ate up (it’s all the time zero if the method isn’t in Idle state).

That’s it for now! In this newsletter, we’ve got defined how to allow the php-fpm standing web page below Nginx internet server. Use the comments shape underneath to percentage your ideas with us.

Check Also

Linux Today – KDE Plasma 5.14 Desktop Environment Gets First Point Release, Update Now

Linux Today – KDE Plasma 5.14 Desktop Environment Gets First Point Release, Update Now

Linux Today – KDE Plasma five.14 Desktop Environment Gets First Point Release, Update Now Oct …

Leave a Reply

Your email address will not be published. Required fields are marked *