Upgrading Ubuntu to 14.04, 500 errors because of .htaccess and other fun things…

vlad ko
Zen of Coding
Published in
2 min readFeb 23, 2015

Did you notice? The site was down for a bit today, because I’ve decided to upgrade Ubuntu to 14.04 LTS.

First of all a bad idea to do so during the day, since I had a bunch of work meetings scheduled already.

Secondly (as it always happens), after a very smooth upgrade, apache failed to start. (httpd.conf was missing)…
oh yea?

[cc lang=”bash”]
touch /etc/apache2/httpd.conf
[/cc]

Restart apache.

I guess we need a blank file. Cool.

Now, with apache successfully started, my site started responding with a good ol’ “500”.

OK, nothing in the error logs, what’s next?

Probably mod “rewrite”. Check all the settings. Disable. Enable. Restart. Fail.

I google some more and wonder if it has something to do with the .htaccess file in the Wordpress install of this blog.

[cc lang=”bash”]
mv .htaccess old.htaccess
service apache2 restart
[/cc]

Whoa the site is working, but redirects are broken. We obviously need .htaccess, but why does it break the site?

What else can I check? The virtual host file:

[cc lang=”bash”]

ServerAdmin admin@zenofcoding.com
ServerName zenofcoding.com
ServerAlias www.zenofcoding.com
DocumentRoot /srv/www/zenofcoding.com/public_html/
ErrorLog /srv/www/zenofcoding.com/logs/error.log
CustomLog /srv/www/zenofcoding.com/logs/access.log combined

[/cc]

Feels kinda empty, let’s look at what the internet suggests as decent vhost file for Wordpress and Ubuntu 14.04.
Somewhat surprised, most of the examples, look just like mine… but one has the following:

[cc lang=”bash”]

AllowOverride All

[/cc]

Let’s try to add it.

[cc lang=”bash”]

ServerAdmin admin@zenofcoding.com
ServerName zenofcoding.com
ServerAlias www.zenofcoding.com
DocumentRoot /srv/www/zenofcoding.com/public_html/
ErrorLog /srv/www/zenofcoding.com/logs/error.log
CustomLog /srv/www/zenofcoding.com/logs/access.log combined

AllowOverride All


[/cc]

Restart apache.

Welcome back.

Looks like things are a bit more strict now, so if you don’t have AllowOverride All in your vhost file and you are getting a 500, chances are you need to enable Overrides somewhere in your apache conf. (The details of how to set it, would depend on your specific environment. The above finally worked for me.)

Enjoy.

--

--

vlad ko
Zen of Coding

holistic developer and architect. bootstrapped successful startups. health, tech, wellness.