首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >php-fpm的Monit配置

php-fpm的Monit配置
EN

Stack Overflow用户
提问于 2011-10-21 08:25:35
回答 6查看 14.6K关注 0票数 9

我很难为php找到一个有效的monit配置。

这就是我尝试过的:

代码语言:javascript
复制
### Monitoring php-fpm: the parent process.
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
  group phpcgi # phpcgi group
  start program = "/etc/init.d/php-fpm start"
  stop program  = "/etc/init.d/php-fpm stop"
  ## Test the UNIX socket. Restart if down.
  if failed unixsocket /var/run/php-fpm.sock then restart
  ## If the restarts attempts fail then alert.
  if 3 restarts within 5 cycles then timeout

但是它失败了,因为没有php-fpm.sock (Centos 6)

EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2011-10-26 22:53:10

我正在使用php中的ping.path指令来检查它是否有效.

并在nginx.conf上配置它(我不知道这是否是您的设置)

代码语言:javascript
复制
location /ping {
    access_log     off;
    allow          127.0.0.1;
    deny           all;
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
    include        fastcgi_params;
}
票数 3
EN

Stack Overflow用户

发布于 2012-06-19 10:47:35

对于其他在Centos 6上有此问题的人,php-fpm套接字位于/var/run/php-fpm/php-fpm.sock中。

因此,最终配置如下所示:

代码语言:javascript
复制
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
  group phpcgi #change accordingly
  start program = "/etc/init.d/php-fpm start"
  stop program  = "/etc/init.d/php-fpm stop"
  if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
  if 3 restarts within 5 cycles then timeout
票数 14
EN

Stack Overflow用户

发布于 2012-06-18 08:23:43

而不是:

代码语言:javascript
复制
if failed unixsocket /var/run/php-fpm.sock then restart

你可以尝试:

代码语言:javascript
复制
if failed port 9000 type TCP then restart

它不需要像location /ping那样编辑lighttpd/nginx。

我在Ubuntu上的/etc/monit/conf.d/php-fpm.conf如下所示:

代码语言:javascript
复制
check process php-fpm with pidfile /var/run/php5-fpm.pid
  stop program = "/sbin/start-stop-daemon --stop --pidfile /var/run/php5-fpm.pid"
  start program  = "/sbin/start-stop-daemon --start --pidfile /var/run/php5-fpm.pid --exec /usr/sbin/php5-fpm"
  if failed port 9000 type TCP then restart
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7846847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档