Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have this in my sites-available apache2 virtual host file:

 <VirtualHost *:80>



Why does apache send requests from to the correct path, but gets sent to the default virtual host?

Update: The reason gets sent to the default virtual host is because the hostname of the machine automatically gets sent to default.

share|improve this question
up vote 3 down vote accepted

(Obvious question -- is the DNS for www and non-www the same?)

For debugging purposes the -S flag is useful to check the config as the apache service itself sees it.

Debian based world:

apache2 -S

Redhat based world:

httpd -S

and another example:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server localhost (/etc/apache2/sites-enabled/000-default:2)
         port 80 namevhost (/etc/apache2/sites-enabled/domain1:16)
         port 80 namevhost (/etc/apache2/sites-enabled/domain2:1
share|improve this answer

I'd check to see if you have the proper DNS records for and - where there is 1 main A record, and then a CNAME for the other.

You can do lookups with the tools at

share|improve this answer

Make sure you have DNS entries set for www to point to

share|improve this answer

Is there a servername directive outside of the < virtualhost > section?

share|improve this answer

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.