Apache2 stops working randomly on Ubuntu

I have a droplet in DigitalOcean that connected to domain that purchased from GoDaddy. Using Apache2 for web server. Some times web site is down and any path in www/html folder is not working. It seems like it’s happening randomly. I am not sure about this but if I run “sudo systemctl status apache2” command when web site down, then web site comes back to work and I see everything is fine.

Ubuntu version: 20.04.1 LTS Apache2 version: 2.4.41

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.


Usually, when your service stops randomly there is an issue either with it along the line or your Droplet is running out of Memory.

The best place to check the error is your apache error log:

  1. tail -n 200 /var/log/apache2/error.log

From there you can see the exact error. From there you can take the appropriate actions.

If it’s out of memory, you can first try adding SWAP, and then if the issue continues, you’ll need to upgrade your Droplet.

If the problem lies elsewhere you’ll need to further troubleshoot the source. Having said that, it should be easy with you having the exact error.

Hello, @spektragamess

What is the output of the command when you execute:

  1. sudo systemctl status apache2

If the Apache server is down you will need to start/restart it with:

  1. sudo systemctl start apache2


  1. sudo systemctl restart apache2

What you can also do is to examine the Apache error log file in order to track down what is causing the issue. You can check the last 200 entries of the file with this command:

  1. tail -n 200 /var/log/apache2/error.log

And also check for out of memory or killed processes:

  1. grep -i oom /var/log/messages


  1. grep -i kill /var/log/messages

Hope that this helps! Regards, Alex