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 a fresh minimal Debian Lenny server with one IP address running just Apache.

I have two domains, and for the purpose of this post, pointing to this one server. The www subdomain is a CNAME to the main domain. Pinging all four entries (the two domains with and without the www subdomain) all point to the correct IP address.

On the server, two virtual hosts have been added to /etc/apache2/sites-available/ as follows:

<VirtualHost *:80>
    DocumentRoot /var/
    <Directory /var/>
            Options FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
    ErrorLog /var/log/apache2/
    LogLevel warn
    CustomLog /var/log/apache2/ combined

The second is just a copy of the above but with site2 references.

Having enabled both virtual hosts, and restarting Apache,, and all point to their correct sites. However for some annoying reason points to the default site (/etc/apache2/sites-available/default) for non-matching virtual hosts.

Can anyone explain why this is happening? I've checked and re-checked the configs, logs, directories and even re-built the server cleanly numerous times and fail to understand Apache's behaviour in this example.

Your help is appreciated.

share|improve this question
up vote 1 down vote accepted

I'm going with typo in the vhost's ServerName, or else the machine's ServerName points to and that's overriding the vhost's definition.

share|improve this answer
Checked the vhost's ServerName entry numerous times now. Even copy and pasted it in all cases to be sure. No difference. When you say the machine's ServerName, where should I be looking exactly? Could it be related to the reverse DNS being the very same address I can't get working? – Asinine Monkey Nov 10 '09 at 17:08
Yes, that's exactly what I mean. – womble Nov 10 '09 at 17:14
Hmm, never actually thought of that. Will alter it and re-test. – Asinine Monkey Nov 10 '09 at 17:29
How annoying. That solved it first time. Lesson learnt I guess. Many thanks. :) – Asinine Monkey Nov 10 '09 at 17:37

I know it might be a late response .. but maybe you should check if you have the NameVirtualHost Directive Set up .. if you have too many Virtual Hosts with it set, Apache will override to either the last one in the list .. or give you an error and not start the service at all ..

share|improve this answer
This is misleading. There are some strange behaviors when mixing NameVirtualHost and other vhost configurations, but not ever because there are "too many". – Jeff Warnica Dec 8 '12 at 22:33

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.