Question

Use "monit" when Cloudflare gives timeout connection or site down, to reset apache2 service.

Hi guys, last three days my website shows as offline, and its going through Cloudflare servers. I dont know what exactly causes that but when i restart apache2 everything is back to normal. I saw the monit utility that can auto restart service in unix, but the question is how can i use it to check automatically and reset apache2 service when that happens. Also i have always online checked in Cloudflare. Thanks in advance


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi and thanks for the answer, the apache error log give

[core:notice] [pid 16249] AH00051: child pid 8935 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:25:37.481054 2016] [core:notice] [pid 16249] AH00051: child pid 8936 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:25:37.481207 2016] [core:notice] [pid 16249] AH00051: child pid 8951 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:25:47.506398 2016] [core:notice] [pid 16249] AH00051: child pid 9027 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:25:51.512591 2016] [core:notice] [pid 16249] AH00051: child pid 9033 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:16.557959 2016] [core:notice] [pid 16249] AH00051: child pid 8867 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:24.570603 2016] [core:notice] [pid 16249] AH00051: child pid 8961 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:33.586873 2016] [core:notice] [pid 16249] AH00051: child pid 9040 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:34.590083 2016] [core:notice] [pid 16249] AH00051: child pid 8910 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:34.590399 2016] [core:notice] [pid 16249] AH00051: child pid 9026 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:35.592309 2016] [core:notice] [pid 16249] AH00051: child pid 8940 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:36.594550 2016] [core:notice] [pid 16249] AH00051: child pid 8984 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:42.604424 2016] [core:notice] [pid 16249] AH00051: child pid 9011 exit signal Segmentation fault (11), possible coredump in /etc/apache2 [Fri Nov 11 23:26:52.654911 2016] [core:notice] [pid 16249] AH00051: child pid 8933 exit signal Segmentation fault (11), possible coredump in /etc/apache2

i was reading about xdebug and core dump and my head is spinning with all the new informations, in this moment i need to find quick fix, because this is happening random and only once in a day, and the problem is i dont have alarm or something to “send mail notify” when this is happening. For now can i use (monit) to restart apache2 when Segmentation fault happens?

Thanks

Did you saw How To Install and Configure Monit? It’s older one, but I think it should be still working. It covers case you need - to automatically restart service if down.

You maybe want to trace root of problem. Logs are your best friend, it could give many informations. You can start with checking syslog for Out Of Memory entries. To do it, open syslog:

  1. sudo nano /var/log/syslog

Try to find any Out of memory entry. If you find it, that means it got killed because it ran out of memory. In this case, you can consider upgrading your Droplet or adding Swap. There is Apache error log too. By default it should be located at /var/log/apache2/error.log. You can open it with text editor as usual:

  1. sudo nano /var/log/apache2/error.log

Maybe it’ll give you insight of error if it isn’t OOM.