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.

Here is the error I get when booting up Apache2:

 * Starting web server apache2
 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [warn] NameVirtualHost *:80 has no VirtualHosts

I first followed this guide on setting up Apache to host multiple sites:

http://www.debian-administration.org/articles/412

I then found a similar question on ServerFault and tried applying the solution, but it didn't help.

Here is an example of my final VirtualHost config:

<VirtualHost *:80>
    ServerAdmin admin@xxx.com
    ServerName  www.xxx.com
    ServerAlias xxx.com

    # Indexes + Directory Root.
    DirectoryIndex index.html
    DocumentRoot /var/www/www.xxx.com

    # Logfiles
    ErrorLog  /var/www/www.xxx.com/logs/error.log
    CustomLog /var/www/www.xxx.com/logs/access.log combined
</VirtualHost>

with the domain X'd out to protect the innocent :-)

Also, I have the conf.d/virtual.conf file mentioned in the guide looking like this:

NameVirtualHost *

The odd thing is that everything appears to work fine for two of the three sites.

share|improve this question
    
Post your complete(!) Apache httpd configuration or at least every NameVirtualHost and <VirtualHost ...> line. –  joschi Oct 21 '09 at 15:39
    
You cannot mix the two types on the same ip:port. I've had a setup where I had two ip's, one had massvhost hanging off it, the other had all the regular namebased hosts. More importantly, what is the goal? What are you trying to achieve? What are your constraints? –  Marcin Oct 21 '09 at 17:31
add comment

4 Answers

up vote 21 down vote accepted

The IP addresses named with NameVirtualHost have to match the IP address in each VirtualHost element.

Example:

NameVirtualHost *:80
NameVirtualHost *:81

<VirtualHost *:80>
# ...
</VirtualHost>

<VirtualHost *:81>
# ...
</VirtualHost>

# This will not work!
<VirtualHost *>
# ...
</VirtualHost>

Read the Apache Virtual Host documentation for details.

share|improve this answer
add comment

Replace this:

NameVirtualHost *

With this:

NameVirtualHost *:80
share|improve this answer
1  
I appreciate the simple answer and wish I could accept both –  rcampbell Oct 23 '09 at 14:08
add comment

Adding to the responses, one thing that i noticed is that you can't run SSL without having explicit declaring the :80 on every NameVirtualHost and VirtualHost directives, apache won't support having:

NameVirtualHost *

and

NameVirtualHost *:443

Mixed up in the same config, you will get errors on apache listening on port zero if you do that.

For me i just added :80 to every host so SSL could work proprietly.

share|improve this answer
add comment

Ex:

<VirtualHost 85.25.97.252:80>
ServerName domain.com
ServerAlias *.domain.com
ServerAdmin webmaster@domain.com
DocumentRoot "/var/www/domain.com/httpdocs/"
<Directory "/var/www/domain.com/httpdocs/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

share|improve this answer
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.