My ongoing experiences with Ubuntu, and later Mythbuntu, as a media center with MythTV. I'm also using the system for a virtual machine server, a mediawiki server and a general all around home infrastructure base.

Monday, November 3, 2008

NameVirtualHost *:80 has no VirtualHosts

After upgrading to 8.10 I saw the following error on an Apache reload:

# apache2ctl restart
[Sun Nov 16 13:36:23 2008] [warn] NameVirtualHost *:80 has no VirtualHosts

Updated Nov 16, 2008: My first solution (below) didn't work, correct solution now immediately follows...

Looks like the problem was I had to NameVirtualHost statements, one in /etc/apache2/ports.conf and one in /etc/apache2/sites-enabled/000-default.

To fix the problem, I simply commented on the declaration in /etc/apache2/ports.conf:

grep NameVirtualHost /etc/apache2/ports.conf
#NameVirtualHost *:80

Old solution I posted, that turned out, did not work.

To fix this, I added a ServerName directive, as follows:

<virtualhost *:80>
    ServerName hostname
    ServerAdmin webmaster@localhost

16 comments:

austway said...

I am a relative newbie - I am also running mythbuntu and recently upgraded to 8.10. I have apache installed and since the upgrade my virtual hosts are not working. The message "NameVirtualHost *:80 has no VirtualHosts" appears in the error.log file. Can you please advise exactly where you added your fix for this?

Much appreciated.

Ken

Von Welch said...

@Ken: I don't have access to my system at this moment, but I'm pretty sure the snippet you see above is the start of /etc/apache2/apache2.conf

Von Welch said...

Updated post with new fix.

austway said...

Von,

I've finally fixed my similar issue! All my virtual .conf files started with the line "VirtualHost *" which seemed to work fine in Ubuntu 8.04, but this is what was causing the issue in 8.10.

I've now changed them all to "VirtualHost *:80" and it all works fine in 8.10.

I hope this may help someone else in this situation.

Joaquín Núñez said...

thx =)

Unknown said...

Hmmm. It likewise worked for me, in that I stopped getting that warning message on apache2 reload. However, my vhosts wouldn't resolve correctly. In the apache docs it says that it is critical that the XXX in <VirtualHost XXX> match whatever XXX you used in ports.conf's NameVirtualHost XXX directive. So I tried the bare IP address (I'm only using one) with no port and it all works. Just in case someone else finds this post looking for help with this Ubuntu 8.10 Intrepid Apache2 Virtual Hosts problem.

Unknown said...

Hi
My problem was exactly same.
Thanks. I also had NameVirtualHost in Ports.conf and when I commented it, it worked fine.

There should be only one NameVirtualHost statement in all conf files.

Alireza Kashian

metjay said...
This comment has been removed by the author.
metjay said...

thanx, saved my day dude, works like a charm

Unknown said...

Thanks. overlooked forever and now i have more hair..

Venipede said...

That helped, thanks!

Paolo said...

thanks!

Rudá Jr. said...

It works for me! ;) Thanks

kaine said...

Hi

Thanks this helped - commented out the line in ports.conf, and all is well!

Víctor Villarreal said...

Ok, problem solved! Thanks!

Ankit Singh Thakur said...

was trying to resolve my problem from past 70-80 minutes.
Finally with help of your article i fixed it.

:)
Thanks very much.