问题原文
原帖链接 · 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
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
