Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My site is only loading with format not with Any idea why? Here are my settings:

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /var/www/
 ErrorLog /var/www/

My DNS settings:

A/AAAA Records

 Hostname   IP Address          TTL 

 www     Default 

Running Ubuntu on Apache2

share|improve this question
You do not need to list in ServerAlias if it's already the ServerName. Other than that the config looks fine. What error do you get? Can you post the output of wget htto:// and wget Or, even better, reveal the domain name? – zhenech Nov 3 '12 at 20:36
@zhenech When I type both in my browser is going to /var/www/ but is going to /var/www/ for some reason. So they both work, just are directing traffic to the wrong folder. – Alex Markov Nov 3 '12 at 20:42
You define DocumentRoot /var/www/, so /var/www/ is the correct folder and should work for both. Is this the only <VirtualHost> you have defined? – zhenech Nov 3 '12 at 20:47
@zhenech This isn't the only one. I just made another one. I suppose things stopped working after I made that one. The other one is a subdomain of It is the only <VirtualHost> in this file though. – Alex Markov Nov 3 '12 at 21:02
What are the ServerName and ServerAlias lines of the other VirtualHost? Apache does not care if the hosts are in one or multiple files. – zhenech Nov 3 '12 at 21:09
up vote 0 down vote accepted

The vhost to load first gets precedence - in this case, it's the one in /etc/apache2/sites-enabled/000-default. I'm assuming that the vhost you're intending to be active is the one in /etc/apache2/sites-enabled/, right?

Run a2dissite default, then restart Apache and you should be good!

share|improve this answer
This worked! Question: where is the vhost loading sequence defined? Default may be useful, is there a way to just put it last in order? Also, how some went before even though it was in the same <VirtualHost> ? – Alex Markov Nov 3 '12 at 23:22
@AlexMarkov It's in load order - when a directory is included, then it's alphabetical, which is why the "default" file that comes in the package gets that 000 stuck in front of it. Now that you've disabled it, your file now acts as the default for hostnames that don't match one of the other virtual hosts. I'm guessing the reason that went to the right vhost is that it was not configured as a ServerAlias in the default file, so the default file wasn't overriding that name, just – Shane Madden Nov 3 '12 at 23:26
Got it! Thanks so much! – Alex Markov Nov 3 '12 at 23:36
But the default host should never have matched in the first place, as it does not contain anywhere? – zhenech Nov 4 '12 at 9:36
@zhenech Based on that apachectl -S output provided in the comments on the question, the vhost in the 000-default file had a ServerName of - so you were right on with the overlapping vhosts. – Shane Madden Nov 4 '12 at 18:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.