Apache2 failing unexpectedly

I am running Ubuntu 20.04 as a web server on a cloud instance. There I have installed apache 2. Daily, I need to restart the instance or the apache2.service to restore access to the website.

sudo systemctl status apache2.service

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-08-31 19:45:10 UTC; 3h 50min ago
   Main PID: 1092 (code=exited, status=1/FAILURE)

Aug 31 19:42:17 bhub systemd[1]: Starting The Apache HTTP Server...
Aug 31 19:42:18 bhub systemd[1]: Started The Apache HTTP Server.
Aug 31 19:45:10 bhub systemd[1]: apache2.service: Main process exited, code=exited, status=1/FAILURE
Aug 31 19:45:10 bhub systemd[1]: apache2.service: Failed with result 'exit-code'.

sudo apache2ctl configtest

Syntax OK

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.


In such cases, it’s always best to check your error log files. In there you’ll be able to find more descriptive messages and see the exact error behind this failure.

You can find the log at /var/log/apache2/error.log. Once you have the error it’s a lot easier to troubleshoot.

If uncertain though, you can always use the Community for more help!

In such cases however when Apache just dies randomly, most probably your Droplet does not have enough memory. You’ll see in the logs if apache was killed due to your Droplet being Ouf Of Memory. I’ll recommend an upgrade if that’s the case.

Hello, @jllandivarscott

I will recommend you examine the Apache error_logs in order to track down the exact issue.

To examine log files for errors while troubleshooting Apache on a Fedora, CentOS, or RedHat server, examine the /var/log/httpd/error_log file.

If you are troubleshooting a Debian or Ubuntu derived system, examine /var/log/apache2/error.log for errors using a tool like tail or less. For example, to view the last two lines of the error log using tail, run the following command:

  1. sudo tail -n 2 /var/log/apache2/error.log

Substitute the number of lines that you would like to examine in place of the number 2 in the command. On a CentOS or Fedora system, the log file to examine is /var/log/httpd/error_log.

You can also follow our tutorial on How To Troubleshoot Common Apache Errors

Regards, Alex