Search code examples
monitphp

Monit configuration for php-fpm


I'm struggling to find a monit config for php-fpm that works.

This is what I've tried:

### 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

But it fails because there is no php-fpm.sock (Centos 6)


Solution

  • I´m using the ping.path directive in php-fpm to check if it´s working...

    and configured it on nginx.conf (i down´t know if it´s your setup)

    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;
    }