Ubuntu Web Server – How I Fixed Apache2 After Ubuntu 14.04 Upgrade

I decided a few hours ago to take a daunting leap forward and upgrade my Ubuntu web server to 14.04. I recently upgraded another computer from Ubuntu 12.04 to 14.04. I was pleased with an outcome.

I decided to perform same upgrade on my web server. Things went pretty smooth until I realized apache2 was failing to start after this upgrade. To my dismay my web server was broken after upgrading from Ubuntu 12.04 to 14.04.

I received these error messages below.

The apache2 configtest failed.

Output of config test was:
apache2: Syntax error on line 210 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/ruby.load: Cannot load /usr/lib/apache2/modules
mod_ruby.so into server: /usr/lib/apache2/modules/mod_ruby.so: cannot open shared object file: No such file or directory

Action ‘configtest’ failed.

The Apache error log may have more information.

Actually an apache error log did not have more information. I fixed that line 210 error by removing ruby as an enabled mod with this command:

rm /etc/apache2/mods-enabled/ruby.load

I then tried to start apache2 with “apache2ctl start” command. I received an error again only this time it changed to:

apache2: Syntax error on line 214 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/httpd.conf: No such file or directory

I fixed this error by creating a blank httpd.conf file using a “touch /etc/apache2/httpd.conf” command. An httpd.conf file is not needed on my web server but just creating a blank file with name of httpd.conf cleared that error. I then tried to start apache2 yet again.

Ubuntu Web Server

Well what do you know, another error message:

AH00526: Syntax error on line of /etc/apache2/apache2.conf: Invalid command ‘LockFile’, perhaps misspelled or defined by a module not included in the server configuration Action ‘start’ failed.

I resolved that error by replacing this line:

LockFile ${APACHE_LOCK_DIR}/accept.lock

with this one

Mutex file:${APACHE_LOCK_DIR} default

in /etc/apache2/apache2.conf

Finally, apache2 started successfully this time. I tested two of my web sites hosted on this newly upgraded to Ubuntu 14.04 web server. Both web sites were accessible and now I could breath a little bit easier.