php-fpm的status可以查看汇总信息和详细信息 nginx.conf 配置文件 server { listen 80; server_name localhost; index index.php index.html; root /home/tinywan/zabbix; location / { try_files $uri $uri/ /index.php?$args; } location
nginx.conf 配置文件
server { listen 80; server_name localhost; index index.php index.html; root /home/tinywan/zabbix; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php7.0.9-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; ##allow 192.168.249.0/24; deny all; } location ~ /php_fpm-status$ { allow 127.0.0.1; #deny all; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/var/run/php7.0.9-fpm.sock; } }
启用php-fpm状态功能
tinywan@tinywan:/opt/php-7.0.9$ cat /opt/php-7.0.9/etc/php-fpm.d/www.conf | grep status_path ;pm.status_path = /status
默认情况下为/status,当然也可以改成其他的,例如/ttlsa_status等等。
vim /opt/php-7.0.9/etc/php-fpm.d/www.conf pm.status_path = /php_fpm-status #去掉了前面的;注释符,并更名为php_fpm-status
修改完php-fpm.conf后,使用service php-fpm reload重新加载配置文件
tinywan@tinywan:/opt/php-7.0.9$ sudo /opt/php-7.0.9/sbin/php-fpm tinywan@tinywan:/opt/php-7.0.9$ ps -aux | grep php-fpm root 2769 4.1 0.1 212532 14676 ? Ss 09:50 0:00 php-fpm: master process (/opt/php-7.0.9/etc/php-fpm.conf) tinywan 2770 3.2 0.1 212532 11084 ? S 09:50 0:00 php-fpm: pool www tinywan 2771 5.9 0.1 212532 11084 ? S 09:50 0:00 php-fpm: pool www tinywan 2773 0.0 0.0 15984 944 pts/21 S+ 09:50 0:00 grep --color=auto php-fpm
使用curl指令查看php-fpm的status
tinywan@tinywan:/usr/local/nginx$ curl localhost/php_fpm-status pool: www process manager: dynamic start time: 13/May/2017:09:50:43 +0800 start since: 986 accepted conn: 2 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 1 active processes: 1 total processes: 2 max active processes: 1 max children reached: 0 slow requests: 0
php-fpm的status可以查看汇总信息和详细信息,详细信息比汇总信息要多出每一个php-fpm进程的相关信息,同时支持多种格式输出,如xml、html和json,默认情况下分别使用如果指令即可:
json格式
tinywan@tinywan:~$ curl localhost/php_fpm-status?json {"pool":"www","process manager":"dynamic","start time":1494640243, "start since":1609,"accepted conn":13,"listen queue":0,"max listen queue":0, "listen queue len":0,"idle processes":1,"active processes":1,"total processes":2, "max active processes":1,"max children reached":0,"slow requests":0}
xml格式
tinywan@tinywan:~$ curl localhost/php_fpm-status?xml <?xml version="1.0" ?> <status> <pool>www</pool> <process-manager>dynamic</process-manager> <start-time>1494640243</start-time> <start-since>1692</start-since> <accepted-conn>15</accepted-conn> <listen-queue>0</listen-queue> <max-listen-queue>0</max-listen-queue> <listen-queue-len>0</listen-queue-len> <idle-processes>1</idle-processes> <active-processes>1</active-processes> <total-processes>2</total-processes> <max-active-processes>1</max-active-processes> <max-children-reached>0</max-children-reached> <slow-requests>0</slow-requests> </status>
所有格式:
Examples for summary status page: http://127.0.0.1/php_fpm-status http://127.0.0.1/php_fpm-status?json http://127.0.0.1/php_fpm-status?html http://127.0.0.1/php_fpm-status?xml Example for detailed status page: http://127.0.0.1/php_fpm-status?full http://127.0.0.1/php_fpm-status?json&full http://127.0.0.1/php_fpm-status?html&full http://127.0.0.1/php_fpm-status?xml&full
浏览器访问xml文件截图
php-fpm status的含义
以上就是教你用php-fpm的status查看详细信息的详细内容,更多请关注自由互联其它相关文章!