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.

When I add the following line to /etc/apache2/apache2.conf, I get the error below after I restart apache:

Include
/usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-vhosts.conf

[Mon Jun 14 12:16:47 2010] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results [Mon Jun 14 12:16:47 2010] [warn] NameVirtualHost *:80 has no VirtualHosts

This is my httpd-vhosts.conf file:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.

<VirtualHost *:80>
   ServerName tirengarfio.com
   DocumentRoot /var/www/rs3

   <Directory /var/www/rs3>
      AllowOverride All
      Options MultiViews Indexes SymLinksIfOwnerMatch
      Allow from All
   </Directory>

   Alias /sf /var/www/rs3/lib/vendor/symfony/data/web/sf
   <Directory "/var/www/rs3/lib/vendor/symfony/data/web/sf">
    AllowOverride All
    Allow from All
   </Directory>
</VirtualHost>

Any idea what's causing this?

share|improve this question

migrated from stackoverflow.com Jun 14 '10 at 17:10

This question came from our site for professional and enthusiast programmers.

3 Answers 3

up vote 5 down vote accepted

There is another NameVirtualHost entry in your http.conf that's causing this issue. Look for an entry like NameVirtualHost *:* somewhere, and removing that should remove that error.

Also, as a side note, it's probably not a good idea to include httpd-vhosts.conf directly from the example documentation, since depending on the permissions it might not be particularly secure. It's also not where other people would expect it to be, although if you're the only one managing the server that becomes less of an issue.

share|improve this answer

There is probably another VirtualHost that interferes with the one you are trying to define. It can be defined in sites-available, sites-enabled or apache2.conf. The VHost definition should look like

NameVirtualHost *:80 
NameVirtualHost *:81

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

<VirtualHost *:81>
# ...
</VirtualHost>
share|improve this answer

It is better if you copy configuration file into /etc directory. Anyway, search (see below) if there is another virtualhost directive in any apache configuration files.

grep -lir virtualhost /etc/apache2

(I guess all apache configuration files are in /etc/apache2 directory)

share|improve this answer

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.