Ubuntu – Apache server virtual hosts not working

Apache2

So I have updated to Ubuntu 14.04 LTS from 12.04. The problem is that my existing virtual hosts are not working after the upgrade. And yes I have tried

sudo a2ensite test.dev

but it says:

ERROR: Site test.dev does not exist!

This is what I have in the
/etc/apache2/sites-available directory

test.dev       mysite.dev      anothersite.dev

the content of test.dev is

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName test.dev
    ServerAlias www.test.dev
    DocumentRoot /var/www/test
</VirtualHost>

and the hosts file

127.0.0.1     test.dev
127.0.0.1     www.test.dev

Best Answer

14.04 upgrades your Apache to 2.4 From this version the config files need to have the .conf extensions, in your case:

test.dev.conf
mysite.dev.conf
anothersite.dev.conf

Just rename your files. You may also need to include some new permissions for the directory

Here's a pretty good guide: https://library.linode.com/web-servers/apache/2.2-2.4-upgrade

Related Question