Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Is there any chance you can show us your actual configuration? Maybe run it through sed to anonymize your site name, if that's important: sed -e s/name/a.example/ -e s/other-name/b.example/ or something. –  larsks Jun 22 '11 at 21:00
    
@larsks pastebin.com/2EjiU5r7 I've not really done anything on it yet, I've basically added a line at the very end to include sites-enabled and it worked for one host, but not two. –  cwallenpoole Jun 22 '11 at 21:19
add comment

1 Answer 1

up vote 5 down vote accepted

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
share|improve this answer
    
Ok, giving you the answer because you inadvertently gave me the answer. –  cwallenpoole Jun 22 '11 at 21:26
    
Thanks! Glad to have led you in the right direction! –  Mike Diehn Jun 23 '11 at 0:41
add comment

Your Answer

 
discard

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.