大网数据广告活动
服务器运维问答

Php-fpm status page is not displayed

· 52CE 我爱测

I've try to get php-fpm status page. When i open /status page in a web browser or directly to fcgi - it says File not found. Could you help - how to fix this. # grep -ER "status|ping" /etc/php5/* | grep -v ":;" /etc/php5/fpm/pool…

问题原文

原帖链接 · BaZZiliO · CC BY-SA 3.0

I've try to get php-fpm status page. When i open /status page in a web browser or directly to fcgi - it says File not found.

Could you help - how to fix this.

# grep -ER "status|ping" /etc/php5/* | grep -v ":;"
/etc/php5/fpm/pool.d/www.conf:pm.status_path = /status
/etc/php5/fpm/pool.d/www.conf:ping.path = /ping
/etc/php5/fpm/pool.d/www.conf:ping.response = pong 

# SCRIPT_NAME=/status SCRIPT_FILENAME=/status QUERY_STRING=  REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php-fpm-www.sock
Primary script unknown
Status: 404 Not Found
Content-type: text/html

File not found.

# SCRIPT_NAME=/ping SCRIPT_FILENAME=/ping REQUEST_METHOD=GET cgi-fcgi -bind -connect /var/run/php-fpm-www.sock
Primary script unknown
Status: 404 Not Found
Content-type: text/html

File not found.

已采纳解答

原帖链接 · Bizmate · CC BY-SA 4.0

I just had the same problem and I am just going to describe what i needed to make it work. You have not shared many details on your php-fpm config or your nginx (if this is what you are using as a web server). Notice you might need to run the instructions below with sudo/as root in front of the commands to have the rights to modify the files or restart services.

In php-fpm config

vi /etc/php-fpm.d/www.conf

Search for the status path directive and enable it

pm.status_path = /status

Then make sure nginx can call this location. In you nginx site config

vi /etc/nginx/conf.d/mysite.conf

Add

location ~ ^/(status|ping)$ {
     access_log off;
     #allow 127.0.0.1;
     #allow 1.2.3.4#your-ip;
     #deny all;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     fastcgi_pass 127.0.0.1:9000;
 }

Notice above i have commented out the allow and deny instructions to have the status page enabled from any IP. Make sure this is not enabled on production. Now restart both nginx and php-fpm

sudo service nginx restart
sudo service php-fpm restart

Calling the status page from the browser should now work

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-08-26)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。