Virtual Host on Top Level Domain not working

mawburn asked:

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 [email protected]
    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

My answer:

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

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.