top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Warning: NameVirtualHost has no VirtualHosts

+1 vote
425 views

I am courious if there are others who have the same observation in my case. I used the Apache documentation to use name based virtual hosts.

My site-enabled file looks now like this:

NameVirtualHost *:80

 ServerName wiki.mydomain.com
 ServerAdmin webmaster@mydomain.com
 DocumentRoot /var/lib/wiki/

 Options +FollowSymLinks
 AllowOverride All
 order allow,deny
 allow from all

 ServerName www.mydomain.com
 ServerAlias *.mydomain.com
 ServerAdmin webmaster@localhost

 DocumentRoot /var/www

 Options FollowSymLinks
 AllowOverride None

 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all

 ErrorLog /var/log/apache2/error.log    
 LogLevel warn    
 CustomLog /var/log/apache2/access.log combined

I want to achieve that wiki.mydomain.com loads the wiki directly, thus the 1st virtual host. All other *.mydomain.com hosts shall be handled by the 2nd virtual host.

Actually, it works (on the surface?), but I get this warning when I restart acpache2:

# service apache2 restart
 * Restarting web server apache2
[Mon Sep 09 11:05:03 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
 ... waiting 
[Mon Sep 09 11:05:04 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
 ...done.

What does the warning really mean?
I have specified Virtual Hosts with pattern *:80, they are apparently working, but why the warning then? How could I change my configuration to make the warning disappear?

posted Sep 9, 2013 by Majula Joshi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
If everything else looks good, it usually means you have 2 "NameVirtualHost *:80".

1 Answer

0 votes

Try something like

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@abc.mydomain.com
    DocumentRoot "/var/www/html/abc"
    ServerName abc.mydoamin.com
</VirtualHost>

This works for me without any issue.

answer Sep 9, 2013 by Salil Agrawal
Similar Questions
+1 vote

I was reading the documentation and testing out some things. We have multiple name based virtual hosts, but would like to display a page when not match is found.
According to the documentation at [http://httpd.apache.org/docs/2.2/vhosts/name-based.html] and [https://httpd.apache.org/docs/2.4/vhosts/name-based.html#defaultvhost], the first matching servername or alias is used, with no precedence for wildcards.

What appears to be working in our case is a 'default' host with 'ServerName *', but how would I know for certain that this is the one that is always used?

Our configuration has the typical include of "/etc/httpd/conf.d/*.conf", it is here that the vhosts are defined in separate files. Should the default also be placed in here or does it have to be defined at the end of the httpd.conf (master) configuration file?

It is currently my understanding that I should place it at the bottom of httpd.conf; so to be sure it is that last that is matched, but I would like to hear from someone with more knowledge and/or experience about apache than myself. I would prefer it to be placed in the conf.d folder if possible.

0 votes

I am using Apache 2.2 on LE for several years now and I use intensively the virtual host mechanism (300 virtual hosts per http instance).

As soon as you start sharing resources between applications, you want to protect your platform and prevent an application from taking all the threads and cause a resource starvation for the others.

To do so i used the third party mod_qos module to limit the number of simultaneous connections per virtual hosts. Now that i intend to migrate to Apache 2.4, my first tests reveal that this module is not compatible with this version of Apache, thats also the warning that developer raised for his module.

It appears that I don't find any real alternative to substitute the mod_qos module with something else. Here are my questions :
- Can you confirm that Apache does not provide any mechanism allowing to limit the number of connection per virtual host, just to be sure that I am not missing something ?
- Why Apache doesn't provide such a functionality ? :) From my very humble user perspective, I am surprised that this is not a native functionality as it seems to me that my need is probably shared by many users. Moreover Apache provides many other complex functionalities, the one I am describing would be probably something simple to implement compared to other functionalities already available.

+2 votes

I want to run three virtual hosts on separate IP addresses for notification messages (the reason is due to how the network kit does the redirection of traffic)

On each of these virtual hosts I want a request for any URI to be sent to the document root default (/index.html or just /)

What the best way to achieve this per virtual host?

+2 votes

I am attempting to set a VirtualHost to Alias two directories, and proxy everything else to a Gunicorn server (adding SSL in passing). The VirtualHost is:

 ServerName abc.xyz.com 
 Alias /media/ "/home/xxx/media/"
 ErrorLog /var/log/apache2/error.log
 Options Indexes MultiViews FollowSymLinks 
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0::1/128
 Alias /admin/static/ "/usr/lib/python2.7/dist-packages/django/contrib/admin/static/"
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all
 Deny from none
 ProxyPass /media/ !
 ProxyPass /admin/static/ ! 
 ProxyPass / http://localhost:8080/
 ProxyPassReverse / http://localhost:8080/

 SSLEngine On
 SSLCertificateFile /etc/apache2/ssl/ssl.crt
 SSLCertificateKeyFile /etc/apache2/ssl/ssl.key

Any ideas as to what here is causing trouble?

...