我正在尝试使用 Monit 监控我的 FPM 守护进程,并且我假设由于重生和 PID 更改,以下不是最佳技术?
check process php5-fpm with pidfile "/var/run/php5-fpm.pid"
start = "/etc/init.d/php5-fpm start"
stop = "/etc/init.d/php5-fpm stop"
if failed port 80 protocol http then restart
据我所知,更好的方法是使用 FPM ping URL,只是我无法使用 Apache 激活它们。
除了设置 FPM 池选项之外,在 Apache/PHP-FPM 中究竟需要做什么:
pm.status_path =/status ping.path =/ping
我希望这能让我简单地去:
拉起状态页面。当我转到此 URL 时,我收到 404 错误。我假设我需要某种处理程序来将/status 和/ping 重定向到本地主机端口 9000 上的我的 FPM 服务器。我该怎么做?
最佳答案
您需要在 apache 中设置默认虚拟主机(000-默认???)来处理/status 和/ping。我使用 nginx(抱歉,但会根据需要进行调整)并且我的 default
文件具有以下位置指令:
location ~ ^/(status|ping)$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
allow 127.0.0.1;
deny all;
}
然后允许我curl localhost/status
。
您还需要更改您的 php-fpm conf(我的是 www.conf)并取消注释行:
pm.status_path = /status
ping.path = /ping
关于linux - PHP-FPM、Monit、ping/状态页面、Apache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8510233/