1. 配置php-fpm
vim /etc/php-fpm.d/www.conf
添加以下配置
pm.status_path = /phpfpm_status
2. 配置Nginx
server {
// nginx状态
location /nginx_status {
stub_status on;
access_log off;
}
// php 状态
location ~^/phpfpm_status$ {
include fastcgi_params;
include /etc/nginx/nginx-common-proxy-pass.conf;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
location ~^/phpfpmping$ {
include fastcgi_params;
include /etc/nginx/nginx-common-proxy-pass.conf;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
// 如果访问的域名匹配不到,直接跳转
location / {
return 301 https://www.zhongliang.com;
}
}
3. 测试
curl --silent http://127.0.0.1/phpfpm_status
pool: www
process manager: dynamic
start time: 03/Sep/2020:11:35:29 +0800
start since: 13
accepted conn: 19
listen queue: 0
max listen queue: 0
listen queue len: 128
idle processes: 5
active processes: 1
total processes: 6
max active processes: 2
max children reached: 0
slow requests: 0