I see, learn and rediscover… everyday!
 
Apache Fix : NameVirtualHost *:80 has no VirtualHosts

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 ]

5 Comments

  1. Szasz-Fabian Jozsef

    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…

  2. Dave

    Always cautious about changing configuration files without fully understanding the implications so I backtracked to fresh install.
    The problem seems to arise if default is removed from /etc/apache2/sites-enabled, because that is where VirtualHost *:80 is defined.
    Not sure about the fix above, but if you are happy to allow http access as well as https, then leave default in sites-enabled.

  3. Hey there, I think your blog might be having browser compatibility
    issues. When I look at your website in Ie, it looks fine but when opdning in Internet Explorer, it has some overlapping.
    I just wanted to give youu a quick heads up! Other
    then that, awesome blog!

Leave a Reply to Ajay Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.