Apache Warn NameVirtualHost *:80 Has No VirtualHosts Error When Start

When start Apache web server or restart the HTTPD service on web host, the following warning message may appears on console or error log, even though Apache HTTP service can still startup and running fine without error.

[warn] NameVirtualHost *:80 has no VirtualHosts

where * can be asterisk itself (*), hostname or IP address.

Luckily the message is just a warning message and does not affect the functionality of web server, and hence the websites hosted on the server can still be served properly. The possible cause for this problem’s symptom is incorrect use of NameVirtualHost.

When the server, dedicated or virtual private server web host, has only one IP address, websites are hosted by Apache via name based virtual hosting. In this case, there should be only one NameVirtualHost been defined. For example,

NameVirtualHost *:80

servername host
serverPath /public_html/
DocumentRoot /public_html/

The name of one or more virtual hosts (websites’ domain name) is defined by “servername” directive. So if you have more than one websites hosted on a single IP address, you will have one NameVirtualHost declaration and many VirtualHost sections to configure those domains.

Beside, try at best to use IPs or * for the NameVirtualHost and directives. In some cases, where the website is assigned a dedicated IP address where only one virtual host is declared, the NameVirtualHost can even be dropped.

Posted in Hosting Knowledge Base by admin at September 29th, 2011.

Leave a Reply

Spam Protection by WP-SpamFree