Question

Problem with virtual hosts

Hi,

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 188.226.137.114, skyo.be. The code is always the same:

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/skyo/public_html ServerName www.skyo.be Serveralias sky.be Serveralias www.skyo.be 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>

</VirtualHost>

This is the first site in that file, when I put another site above this code, this site is visible on skyo.be. 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:https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts

Does anyone have an idea how to get this fixed?

thanks!!

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.