Apache2 fails to start after rebooting droplet

March 31, 2017 385 views
Apache Ubuntu 16.04

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?

2 Answers

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.

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.

  • Yes, I'll definitely be more careful in the future. Fortunately there's not much to the conf file so I did remember how it looked. Here's the contents of /var/log/apache2/error.log:

    [Fri Mar 31 06:25:04.867685 2017] [mpm_prefork:notice] [pid 23039] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
    [Fri Mar 31 06:25:04.867775 2017] [core:notice] [pid 23039] AH00094: Command line: '/usr/sbin/apache2'
    [Fri Mar 31 07:00:30.864692 2017] [:error] [pid 28716] [client 108.180.207.253:50368] script '/var/www/benchmarkhomerepair.com/public_html/xmlrpc.php' not found or unable to stat
    [Fri Mar 31 07:00:30.918433 2017] [:error] [pid 28716] [client 108.180.207.253:50368] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:00:30.972489 2017] [:error] [pid 28716] [client 108.180.207.253:50368] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:00:31.127219 2017] [:error] [pid 28716] [client 108.180.207.253:50368] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:00:31.181909 2017] [:error] [pid 28716] [client 108.180.207.253:50368] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:04:06.468040 2017] [:error] [pid 28638] [client 217.70.32.2:61717] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat, referer: http://benchmarkhomerepair.com/wp-login.php
    [Fri Mar 31 07:37:56.924657 2017] [:error] [pid 28717] [client 92.222.74.29:52227] script '/var/www/benchmarkhomerepair.com/public_html/xmlrpc.php' not found or unable to stat
    [Fri Mar 31 07:47:27.026169 2017] [:error] [pid 28717] [client 124.83.126.113:63415] script '/var/www/benchmarkhomerepair.com/public_html/xmlrpc.php' not found or unable to stat
    [Fri Mar 31 07:47:27.424662 2017] [:error] [pid 28717] [client 124.83.126.113:63415] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:47:27.814319 2017] [:error] [pid 28717] [client 124.83.126.113:63415] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:47:28.305465 2017] [:error] [pid 28717] [client 124.83.126.113:63415] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 07:47:28.697895 2017] [:error] [pid 28717] [client 124.83.126.113:63415] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    [Fri Mar 31 08:03:06.583170 2017] [:error] [pid 28638] [client 185.129.148.181:43150] script '/var/www/benchmarkhomerepair.com/public_html/kup.php' not found or unable to stat
    [Fri Mar 31 08:25:01.737801 2017] [:error] [pid 28717] [client 121.200.55.155:61468] script '/var/www/benchmarkhomerepair.com/public_html/xmlrpc.php' not found or unable to stat
    [Fri Mar 31 08:25:02.333392 2017] [:error] [pid 28717] [client 121.200.55.155:61468] script '/var/www/benchmarkhomerepair.com/public_html/wp-login.php' not found or unable to stat
    

    Obviously the wp-login.php file is wordpress related, but there is no wordpress instance located there currently. When I was ftping files over after creating the virtual host, there must have been some stray wordpress files moved over and then removed right away. It's weird that making changes to one conf brought down all my sites.

Have another answer? Share your knowledge.