PHP-FPM Status Page 設定

node/1195

PHP-FPM のステータスをwebで確認できるように設定。

$ sudo vi /etc/php/7.2/fpm/pool.d/www.conf
; Default Value: not set
pm.status_path = /status

設定確認、サービス再起動

$ sudo php-fpm7.2 -t
[20-Dec-2018 06:40:43] NOTICE: configuration file /etc/php/7.2/fpm/php-fpm.conf test is successful
$ sudo systemctl restart php7.2-fpm.service

Nginx location ブロック追加

$ sudo vi /etc/nginx/sites-available/default
    location ~ ^/(status|ping)$ {
        allow 127.0.0.1;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock;
    }

ステータス表示

$ curl -L http://127.0.0.1/status
pool:                 www
process manager:      dynamic
start time:           20/Dec/2018:06:41:17 +0000
start since:          328
accepted conn:        83
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       2
active processes:     1
total processes:      3
max active processes: 2
max children reached: 0
slow requests:        0