Centos – My VirtualHosts overlap and the NameVirtualHost has no VirtualHosts

apache-2.2centosvirtualhost

I think that the question title pretty much says the problem. I'm getting these two errors when I restart httpd:

[Wed Jun 22 13:39:23 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jun 22 13:39:23 2011] [warn] NameVirtualHost *:80 has no VirtualHosts

I am including a file which has this as the only line:

NameVirtualHost *:80

And both of the VirtualHosts are almost identical to this:

<VirtualHost *:80>
        ServerAdmin webmaster@<other-name>.com

        DocumentRoot /var/www
        ServerName www.<name>.com
        ServerAlias <name>.com *.<name>.com
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/httpd/error_log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/httpd/access_log combined

</VirtualHost>

Clearly, I am missing something obvious which effects this outcome, but I don't know what. (Obviously, both sites are currently directing to the same page)

(Not certain if this matters, but I ma using CentOS).

SOLUTION

Totally appreciated Mike Diehn's solution below, but it is slightly different solution than he suggested.

I ran:

/usr/sbin/httpd -t -D DUMP_VHOSTS

And I got

[Wed Jun 22 14:23:20 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Wed Jun 22 14:23:20 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443          <name-one>.com (/etc/httpd/conf.d/ssl.conf:81)
*:80                   www.<name-one>.com (/etc/httpd/conf/sites-enabled/100-default:1)
*:80                   www.<name-two>.info (/etc/httpd/conf/sites-enabled/200-info:1)
*:*                    www.<!!!!!!!!!!!!!!>.com (/etc/httpd/conf/sites-enabled/6-<bad>.com:1)
Syntax OK

Notice the !!!!!!!!!!!? That was there because I accidentally copied it from somewhere else. It gobbled up everything and made it not work.

Best Answer

Are you sure your NameVirtualHost directive is actually being "seen" by Apache? That's a common mistake we see

Hey, try this command:

/usr/sbin/apache2ctl -t -D DUMP_VHOSTS

Here's what I see from it on a server that's working properly for me:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server loghost.example.com (/etc/apache2/vhosts.d/10_loghost.example.com.conf:4)
         port * namevhost loghost.example.com (/etc/apache2/vhosts.d/10_loghost.example.com.conf:4)
         port * namevhost netflow.example.com (/etc/apache2/vhosts.d/20_netflow.fluent.com.conf:4)
         port * namevhost licensewatch.example.com (/etc/apache2/vhosts.d/40_licensewatch.example.com.conf:8)
Syntax OK