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

I'm trying to route a top level domain through Apache Virtual Hosts, but I can't seem to get it to work.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/tgc
</VirtualHost> works perfectly. But continues to route to /var/www. I've tried suggestions here and many different combinations, but nothing seems to work.

apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
     default server (/etc/apache2/sites-enabled/000-default:1)
     port 80 namevhost (/etc/apache2/sites-enabled/000-default:1)
     port 80 namevhost (/etc/apache2/sites-enabled/000-default:54)
Syntax OK
share|improve this question
Did you define it somewhere else? Post the output of httpd -S. – Michael Hampton Oct 3 '13 at 0:43
@MichaelHampton yeah that doesn't look right... but I don't know how to fix it. Edited to question. – mburn Oct 3 '13 at 1:23
up vote 3 down vote accepted

You defined two virtual hosts for your domain, and so only one of them is used. Fix this by removing one of them.

share|improve this answer
Yup. I had to change the DocumentRoot on the main VirtualHost to the correct path. This server is hosting many different subdomains and I did not think of that.... Thank you. – mburn Oct 3 '13 at 1: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.