question about Apache

Derek Broughton news at
Fri Feb 29 15:58:07 UTC 2008

Scott Berry wrote:

> Hello there,
> I have a question about Apache I am unsure of.
>   When I run /etc/init.d/apache2 restart I get the following message:
> root at Yellobo:~# /etc/init.d/apache2 restart
>  * Restarting web server apache2
> [Fri Feb 29 05:25:42 2008] [warn] NameVirtualHost *:0 has no VirtualHosts
> [Fri Feb 29 05:25:55 2008] [warn] NameVirtualHost *:0 has no VirtualHosts

You know this is just a warning, right?  I had it for years.  Turns out the
simple fix is to make sure you only have ONE "NameVirtualHost" statement in
your config files.

> NameVirtualHost *:80

That _should_ be "NameVirtualHost *" - but, of course you don't need it and
don't want it if you have another one.

> <VirtualHost *:80>

That should _also_ not specify the port.

> ServerName
> ServerAlias

This is the part that is doing the real work - by checking the host name on
the request headers, and verifying that it's the name of the VirtualHost/
> <VirtualHost *:80>

And the same again...
> <Directory /var/www/>

HEY! You can't do that!  If you want /var/www to be defined differently for
different VirtualHosts you have to define it _inside_ the <VirtualHost>

> </VirtualHost>

And that's no use because you already closed that <VirtualHost> tag.


More information about the ubuntu-users mailing list