Configure Monit to monitor PHP5-FPM on Ubuntu/Nginx setup Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Come Celebrate our 10 Year Anniversary!Blank Page: wordpress on nginx+php-fpmmysql monitoring with monitConfigure php5-fpm for many concurrent userscannot restart php5-fpmnginx php5-fpm path_info urls and root locationphp5-fpm does not initialize after ubuntu 12.04 rebootNGINX don't parse .php5 as .phpphp5-fpm doesn't create sockets for poolsCodeIgniter nginx rewrite rules for i8ln URL'sPeculiar NGinx / PHP5-FPM behavior

Lights are flickering on and off after accidentally bumping into light switch

Recursive calls to a function - why is the address of the parameter passed to it lowering with each call?

Etymology of 見舞い

How to create a command for the "strange m" symbol in latex?

Is the Mordenkainen's Sword spell underpowered?

Determine the generator of an ideal of ring of integers

Why isn't everyone flabbergasted about Bran's "gift"?

How do I deal with an erroneously large refund?

lm and glm function in R

Can gravitational waves pass through a black hole?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Coin Game with infinite paradox

Why do C and C++ allow the expression (int) + 4*5?

Is there a verb for listening stealthily?

"Destructive force" carried by a B-52?

What is the definining line between a helicopter and a drone a person can ride in?

Are Flameskulls resistant to magical piercing damage?

Pointing to problems without suggesting solutions

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Why do people think Winterfell crypts is the safest place for women, children & old people?

/bin/ls sorts differently than just ls

Compiling and throwing simple dynamic exceptions at runtime for JVM

Why is one lightbulb in a string illuminated?

Does traveling In The United States require a passport or can I use my green card if not a US citizen?



Configure Monit to monitor PHP5-FPM on Ubuntu/Nginx setup



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Blank Page: wordpress on nginx+php-fpmmysql monitoring with monitConfigure php5-fpm for many concurrent userscannot restart php5-fpmnginx php5-fpm path_info urls and root locationphp5-fpm does not initialize after ubuntu 12.04 rebootNGINX don't parse .php5 as .phpphp5-fpm doesn't create sockets for poolsCodeIgniter nginx rewrite rules for i8ln URL'sPeculiar NGinx / PHP5-FPM behavior



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















System: LEMP running on Ubuntu 14.04



I'm trying to configure the tool Monit to restart Nginx or PHP-FPM if ever there is a problem. It is correctly monitoring Nginx however under status for PHP-FPM it says "Not Monitoring". Apparently I'm having it check the wrong location.



Here is my Nginx configuration for PHP-FPM that is running on a socket:



location ~ .php$ ## Execute PHP scripts
if (!-e $request_filename) rewrite / /index.php last; ## Catch 404s that try_files miss

expires off; ## Do not cache dynamic content
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; ## See /etc/nginx/fastcgi_params

fastcgi_keep_conn on; #hhvm param



Here is my Monit configuration for both Nginx and PHP-FPM:



## Check Nginx
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
## Check PHP-FPM
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
group www-data #change accordingly
start program = "/etc/init.d/php5-fpm start"
stop program = "/etc/init.d/php5-fpm stop"
if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
if 3 restarts within 5 cycles then timeout


I went with the suggested start and stop recommendations despite always restarting with "service php5-fpm restart".



My group - according to /etc/php5/fpm/pool.d/www.conf - is "group = www-data". I checked my php-fpm.conf and noticed that the PID file is being created at /var/run/php5-fpm.pid so I changed that. Then Monit said "Initializing" followed by "Connection failed". Any suggestions?










share|improve this question




























    0















    System: LEMP running on Ubuntu 14.04



    I'm trying to configure the tool Monit to restart Nginx or PHP-FPM if ever there is a problem. It is correctly monitoring Nginx however under status for PHP-FPM it says "Not Monitoring". Apparently I'm having it check the wrong location.



    Here is my Nginx configuration for PHP-FPM that is running on a socket:



    location ~ .php$ ## Execute PHP scripts
    if (!-e $request_filename) rewrite / /index.php last; ## Catch 404s that try_files miss

    expires off; ## Do not cache dynamic content
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params; ## See /etc/nginx/fastcgi_params

    fastcgi_keep_conn on; #hhvm param



    Here is my Monit configuration for both Nginx and PHP-FPM:



    ## Check Nginx
    check process nginx with pidfile /var/run/nginx.pid
    start program = "/etc/init.d/nginx start"
    stop program = "/etc/init.d/nginx stop"
    ## Check PHP-FPM
    check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
    group www-data #change accordingly
    start program = "/etc/init.d/php5-fpm start"
    stop program = "/etc/init.d/php5-fpm stop"
    if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
    if 3 restarts within 5 cycles then timeout


    I went with the suggested start and stop recommendations despite always restarting with "service php5-fpm restart".



    My group - according to /etc/php5/fpm/pool.d/www.conf - is "group = www-data". I checked my php-fpm.conf and noticed that the PID file is being created at /var/run/php5-fpm.pid so I changed that. Then Monit said "Initializing" followed by "Connection failed". Any suggestions?










    share|improve this question
























      0












      0








      0


      1






      System: LEMP running on Ubuntu 14.04



      I'm trying to configure the tool Monit to restart Nginx or PHP-FPM if ever there is a problem. It is correctly monitoring Nginx however under status for PHP-FPM it says "Not Monitoring". Apparently I'm having it check the wrong location.



      Here is my Nginx configuration for PHP-FPM that is running on a socket:



      location ~ .php$ ## Execute PHP scripts
      if (!-e $request_filename) rewrite / /index.php last; ## Catch 404s that try_files miss

      expires off; ## Do not cache dynamic content
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params; ## See /etc/nginx/fastcgi_params

      fastcgi_keep_conn on; #hhvm param



      Here is my Monit configuration for both Nginx and PHP-FPM:



      ## Check Nginx
      check process nginx with pidfile /var/run/nginx.pid
      start program = "/etc/init.d/nginx start"
      stop program = "/etc/init.d/nginx stop"
      ## Check PHP-FPM
      check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
      group www-data #change accordingly
      start program = "/etc/init.d/php5-fpm start"
      stop program = "/etc/init.d/php5-fpm stop"
      if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
      if 3 restarts within 5 cycles then timeout


      I went with the suggested start and stop recommendations despite always restarting with "service php5-fpm restart".



      My group - according to /etc/php5/fpm/pool.d/www.conf - is "group = www-data". I checked my php-fpm.conf and noticed that the PID file is being created at /var/run/php5-fpm.pid so I changed that. Then Monit said "Initializing" followed by "Connection failed". Any suggestions?










      share|improve this question














      System: LEMP running on Ubuntu 14.04



      I'm trying to configure the tool Monit to restart Nginx or PHP-FPM if ever there is a problem. It is correctly monitoring Nginx however under status for PHP-FPM it says "Not Monitoring". Apparently I'm having it check the wrong location.



      Here is my Nginx configuration for PHP-FPM that is running on a socket:



      location ~ .php$ ## Execute PHP scripts
      if (!-e $request_filename) rewrite / /index.php last; ## Catch 404s that try_files miss

      expires off; ## Do not cache dynamic content
      fastcgi_pass unix:/var/run/php5-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params; ## See /etc/nginx/fastcgi_params

      fastcgi_keep_conn on; #hhvm param



      Here is my Monit configuration for both Nginx and PHP-FPM:



      ## Check Nginx
      check process nginx with pidfile /var/run/nginx.pid
      start program = "/etc/init.d/nginx start"
      stop program = "/etc/init.d/nginx stop"
      ## Check PHP-FPM
      check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
      group www-data #change accordingly
      start program = "/etc/init.d/php5-fpm start"
      stop program = "/etc/init.d/php5-fpm stop"
      if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
      if 3 restarts within 5 cycles then timeout


      I went with the suggested start and stop recommendations despite always restarting with "service php5-fpm restart".



      My group - according to /etc/php5/fpm/pool.d/www.conf - is "group = www-data". I checked my php-fpm.conf and noticed that the PID file is being created at /var/run/php5-fpm.pid so I changed that. Then Monit said "Initializing" followed by "Connection failed". Any suggestions?







      ubuntu nginx monitoring php-fpm monit






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 4 '14 at 16:29









      sparecyclesparecycle

      3071415




      3071415




















          2 Answers
          2






          active

          oldest

          votes


















          0














          Ok, I was able to solve it myself. There were a number of problems. "php5" needed to replace almost every instance of "php". The bad connection I was receiving was referring to the unixsocket so I had to update that as well. Also the new PID location changed it looks like with PHP5-FPM. Here is the final configuration.



          ## Check PHP-FPM
          check process php5-fpm with pidfile /var/run/php5-fpm.pid
          group www-data #change accordingly
          start program = "/etc/init.d/php5-fpm start"
          stop program = "/etc/init.d/php5-fpm stop"
          if failed unixsocket /var/run/php5-fpm.sock then restart
          if 3 restarts within 5 cycles then timeout





          share|improve this answer
































            0














            This is the configuration I've been using for a long time and works great



            check process php5-fpm with pidfile /var/run/php5-fpm.pid
            group phpcgi
            if not exist for 2 cycles then restart
            start program = "/usr/sbin/service php5-fpm start"
            stop program = "/usr/sbin/service php5-fpm stop"
            if not exist for 2 cycles then restart
            if failed unixsocket /var/run/php5-fpm.sock then restart
            if 5 restarts within 5 cycles then timeout





            share|improve this answer























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "2"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f649213%2fconfigure-monit-to-monitor-php5-fpm-on-ubuntu-nginx-setup%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Ok, I was able to solve it myself. There were a number of problems. "php5" needed to replace almost every instance of "php". The bad connection I was receiving was referring to the unixsocket so I had to update that as well. Also the new PID location changed it looks like with PHP5-FPM. Here is the final configuration.



              ## Check PHP-FPM
              check process php5-fpm with pidfile /var/run/php5-fpm.pid
              group www-data #change accordingly
              start program = "/etc/init.d/php5-fpm start"
              stop program = "/etc/init.d/php5-fpm stop"
              if failed unixsocket /var/run/php5-fpm.sock then restart
              if 3 restarts within 5 cycles then timeout





              share|improve this answer





























                0














                Ok, I was able to solve it myself. There were a number of problems. "php5" needed to replace almost every instance of "php". The bad connection I was receiving was referring to the unixsocket so I had to update that as well. Also the new PID location changed it looks like with PHP5-FPM. Here is the final configuration.



                ## Check PHP-FPM
                check process php5-fpm with pidfile /var/run/php5-fpm.pid
                group www-data #change accordingly
                start program = "/etc/init.d/php5-fpm start"
                stop program = "/etc/init.d/php5-fpm stop"
                if failed unixsocket /var/run/php5-fpm.sock then restart
                if 3 restarts within 5 cycles then timeout





                share|improve this answer



























                  0












                  0








                  0







                  Ok, I was able to solve it myself. There were a number of problems. "php5" needed to replace almost every instance of "php". The bad connection I was receiving was referring to the unixsocket so I had to update that as well. Also the new PID location changed it looks like with PHP5-FPM. Here is the final configuration.



                  ## Check PHP-FPM
                  check process php5-fpm with pidfile /var/run/php5-fpm.pid
                  group www-data #change accordingly
                  start program = "/etc/init.d/php5-fpm start"
                  stop program = "/etc/init.d/php5-fpm stop"
                  if failed unixsocket /var/run/php5-fpm.sock then restart
                  if 3 restarts within 5 cycles then timeout





                  share|improve this answer















                  Ok, I was able to solve it myself. There were a number of problems. "php5" needed to replace almost every instance of "php". The bad connection I was receiving was referring to the unixsocket so I had to update that as well. Also the new PID location changed it looks like with PHP5-FPM. Here is the final configuration.



                  ## Check PHP-FPM
                  check process php5-fpm with pidfile /var/run/php5-fpm.pid
                  group www-data #change accordingly
                  start program = "/etc/init.d/php5-fpm start"
                  stop program = "/etc/init.d/php5-fpm stop"
                  if failed unixsocket /var/run/php5-fpm.sock then restart
                  if 3 restarts within 5 cycles then timeout






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 4 '14 at 17:02

























                  answered Dec 4 '14 at 16:41









                  sparecyclesparecycle

                  3071415




                  3071415























                      0














                      This is the configuration I've been using for a long time and works great



                      check process php5-fpm with pidfile /var/run/php5-fpm.pid
                      group phpcgi
                      if not exist for 2 cycles then restart
                      start program = "/usr/sbin/service php5-fpm start"
                      stop program = "/usr/sbin/service php5-fpm stop"
                      if not exist for 2 cycles then restart
                      if failed unixsocket /var/run/php5-fpm.sock then restart
                      if 5 restarts within 5 cycles then timeout





                      share|improve this answer



























                        0














                        This is the configuration I've been using for a long time and works great



                        check process php5-fpm with pidfile /var/run/php5-fpm.pid
                        group phpcgi
                        if not exist for 2 cycles then restart
                        start program = "/usr/sbin/service php5-fpm start"
                        stop program = "/usr/sbin/service php5-fpm stop"
                        if not exist for 2 cycles then restart
                        if failed unixsocket /var/run/php5-fpm.sock then restart
                        if 5 restarts within 5 cycles then timeout





                        share|improve this answer

























                          0












                          0








                          0







                          This is the configuration I've been using for a long time and works great



                          check process php5-fpm with pidfile /var/run/php5-fpm.pid
                          group phpcgi
                          if not exist for 2 cycles then restart
                          start program = "/usr/sbin/service php5-fpm start"
                          stop program = "/usr/sbin/service php5-fpm stop"
                          if not exist for 2 cycles then restart
                          if failed unixsocket /var/run/php5-fpm.sock then restart
                          if 5 restarts within 5 cycles then timeout





                          share|improve this answer













                          This is the configuration I've been using for a long time and works great



                          check process php5-fpm with pidfile /var/run/php5-fpm.pid
                          group phpcgi
                          if not exist for 2 cycles then restart
                          start program = "/usr/sbin/service php5-fpm start"
                          stop program = "/usr/sbin/service php5-fpm stop"
                          if not exist for 2 cycles then restart
                          if failed unixsocket /var/run/php5-fpm.sock then restart
                          if 5 restarts within 5 cycles then timeout






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Sep 1 '16 at 13:45









                          Pian0_M4nPian0_M4n

                          15015




                          15015



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Server Fault!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f649213%2fconfigure-monit-to-monitor-php5-fpm-on-ubuntu-nginx-setup%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                              Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                              What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company