PHP-FPM、Monit、ping/状态页、Apache
我正在尝试使用 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 激活这些 URL。
除了设置 FPM 池选项之外,在 Apache/PHP-FPM 中到底需要做什么:
pm.status_path = /status ping.path = /ping
我希望可以让我简单地访问:
调出状态页面。当我访问此 URL 时,收到 404 错误。我假设我需要某种处理程序来将 /status 和 /ping 重定向到本地主机端口 9000 上的 FPM 服务器。我该如何执行此操作?
I'm trying to monitor my FPM daemon with Monit, and I'm assuming that the following is not the best technique due to respawning and the PID changing?
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
From what I can gather, the better way to do this is to make use of the FPM ping URLs, only I'm unable to activate these with Apache.
What exactly has to be done in Apache/PHP-FPM, other than setting the FPM pool option:
pm.status_path = /status
ping.path = /ping
which I was hoping would allow me to simply go to:
to pull up the status page. When I go to this URL I'm getting 404 errors. I'm assuming that I need some sort of handler to redirect /status and /ping to my FPM server on localhost port 9000. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在 apache 中设置默认虚拟主机(000-default???)来处理 /status 和 /ping。我使用 nginx(抱歉,但根据需要进行调整),我的
default
文件具有以下位置指令:然后允许我
curl localhost/status
。您还需要更改 php-fpm conf(我的是 www.conf)并取消注释以下行:
You would need to set up the default vhost in apache (000-default???) to handle /status and /ping. I use nginx (apologies, but adapt as needed) and my
default
file has the following location directive:Which then allows me to
curl localhost/status
.You also need to change your php-fpm conf (mine is www.conf) and uncomment the lines:
这个线程也帮助了我...正在获得白色的“空白”PHP 页面。
在我的 /etc/nginx/fastcgi_params
添加了这个,
就像一个魅力
this thread helped me too ... Was getting White "Blank" PHP pages.
in my /etc/nginx/fastcgi_params
added this
Worked like a charm
我在这里发布了与 Bitnami LAMP 堆栈相关的完整问答:
设置并访问 Bitnami LAMP 堆栈中的 PHP-FPM 状态页面
此处的详细信息也应适用于您的设置,但您可能需要更改Apache 配置如下:
基本来说,处理程序应该首先匹配您用来将文件发送到 PHP-FPM 的任何名称。使用 bitnami 时,相关的conf设置如下所示:
因此,对于此设置,我们使用:
但对于任何其他安装,请查找您通常为PHP-FPM使用的内容,然后在为您的状态设置处理程序时复制它页。
I posted a full Q&A for this relating to the Bitnami LAMP stack here:
Set up and access the PHP-FPM status page in Bitnami LAMP stack
The details there should also apply to your set-up, but you will probably need to change the Apache config to something like:
In basic terms, the handler should match whatever name you're using to send files to PHP-FPM in the first place. When using bitnami the relevant conf setting looks like:
So, for this set-up, we use:
But for any other installation look up what you're using in general for PHP-FPM and then replicate that when setting the handler for your status page.