Question

Apache2 fails to start after rebooting droplet

After rebooting my droplet for the first time (using shutdown -h now from the command line, then powering on again from the control panel), I was able to ssh into my droplet again as normal, but all sites powered by the droplet refused to connect. I tried to restart apache2:

sudo systemctl restart apache2

…but that returned a warning:

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

I used the status command indicated above which returned:

apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Fri 2017-03-31 19:28:24 UTC; 10s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1992 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

I checked the error log located at

/var/log/apache2/error.log

…and found many weird errors related to one of the sites hosted on the droplet. Then I remembered that I had been trying to figure out how to enable caching on that site, and had made some changes to its conf file at /etc/apache2/sites-enabled/messedupsite.com.conf … perhaps that was the problem?


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 kelseybarmettler,

I am gland that you have resolved your problem your self.

I want to inform you that whenever you make any changes in any configuration file, please create a backup of the old one to some other place to server.if something goes wrong you can always restore the old one.

if you you can provide the output of error logs, we can analyze why the site was getting connect.

I edited my conf file for the site I had messed with, and deleted the following lines which I had earlier added:

CacheQuickHandler off

    CacheLock on
    CacheLockPath /tmp/mod_cache-lock
    CacheLockMaxAge 5

    CacheIgnoreHeaders Set-Cookie

    <Location />
        CacheEnable disk
        CacheHeader on

        CacheDefaultExpire 600
        CacheMaxExpire 86400
        CacheLastModifiedFactor 0.5

        ExpiresActive on
        ExpiresDefault "access plus 5 minutes"
    </Location>

After saving and closing the file, I tried restarting apache2 again and it worked. All sites were back up. So for anyone experiencing the above error, perhaps look in the direction of a recently edited conf file? If anyone knows why what I did made Apache refuse to start, please share away. I just wanted to post my steps in case it helps someone in the same position.