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

»»»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
<VirtualHost *:80>
servername host
serverPath /public_html/
DocumentRoot /public_html/
</VirtualHost>

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 <VirtualHost> 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.

For more example on how VirtualHost supposed to be setup, visit Apache 2.2 documentation or Apache 1.3 documentation (more common version of Apache used currently as most control panel such as cPanel comes with this, although it’s going to be upgraded in cPanel 11).

By |2018-02-06T22:04:33+00:00February 6th, 2018|Categories: Web Servers|Tags: |15 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.

STAY IN TOUCH

close-link