Apache Fix : NameVirtualHost *:80 has no VirtualHosts

I get this error every time I install apache web-server in an ubuntu machine. We use LAMP stack at Interviewstreet and this error was nagging me all the this while.

The error message shows up something like this.


root@interviewstreet:~# /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using interviewstreet.com for ServerName
[warn] NameVirtualHost *:80 has no VirtualHosts ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using interviewstreet.com for ServerName
[warn] NameVirtualHost *:80 has no VirtualHosts [ OK ]

After some googling, I found the actual solution at http://serverfault.com/questions/1405/apache2-startup-warning-namevirtualhost-80-has-no-virtualhosts.

The reason why this happens is because of having NameVirtualHost in more than one place. In this case, it occurs at 2 different files, sites-available/default and ports.conf.

So, this is how we fixed this issue.

1. Removed the line “NameVirtualHost *” from sites-available/default.
2. Changed “NamedVirtualHost *:80″ to “NamedVirtualHost *” in ports.conf

Done. That fixes the problem. Now apache restart shows something like this.

root@interviewstreet:/etc/apache2/sites-available# /etc/init.d/apache2 restart
* Restarting web server apache2 ... waiting [ OK ]

3 thoughts on “Apache Fix : NameVirtualHost *:80 has no VirtualHosts

  1. Thank you!
    I was looking at many places to find the cause of this nasty warning…
    I was looking everywhere, except ports.conf. Who expected to find the other NamedVirtualHost * there…

Leave a Reply to ludovic Cancel reply

Your email address will not be published. Required fields are marked *


eight + 9 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>