PHP-FPM Status Page 設定

Nid: 1195

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

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

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

$ sudo php-fpm"$PHP_VERSION" -t
[20-Dec-2018 06:40:43] NOTICE: configuration file /etc/php/7.2/fpm/php-fpm.conf test is successful
$ sudo systemctl restart php"$PHP_VERSION"-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;
    }
$ sudo nginx -t && sudo nginx -s reload

ステータス表示

$ 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