Problem with virtual hosts


I set up virtual hosts on ubuntu 12.04. But not everything is going as it should. I have two files in sites-enabled. One file holds the code for one site, and it works, one for a dozen other sites, and they work also. Except now I try to add another one to the second file, and the site cannot be found. Strangely enough, the first site in that file is also the site that is visible when I go to the ip of my server, The code is always the same:

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/skyo/public_html ServerName Serveralias Serveralias ErrorLog /var/www/skyo/logs/error.log Loglevel warn CustomLog /var/www/skyo/logs/access.log combined <Directory /var/www/skyo/public_html> AllowOverride All Order allow,deny allow from all </Directory>


This is the first site in that file, when I put another site above this code, this site is visible on So is the new site I wanted to add. So I can access the site, all the redirections work.

I know this is kind of a mess, I would like to have different files, so for each site one file in sites-available instead of one (strangely enough the second file works). I followed the tutorial on creating virtual hosts:

Does anyone have an idea how to get this fixed?


Show comments

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.

This comment has been deleted

The vhosts are meant to be in /etc/apache2/sites-available not sites-enabled. Once you’ve created your vhost in sites-available you need to then run a2ensite and choose the config you want to enable which will create a link in sites-enabled.