I'm running a stock Debian Lenny install with Apache 2. I've noticed that in /etc/apache2/ports.conf there's the following directive:

NameVirtualHost *:80

I don't have any virtual hosts on *:80 because of the way things are set up on the server (multiple IP addresses, some load balanced, some hosts running http, others using https) and I have the following line in another file:

NameVirtualHost www.xxx.yyy.zzz:80

Where www.xxx.yyy.zzz is the IP address I want these sites to respond on. Every VirtualHost container uses that IP address if running http, and the https hosts use a unique IP address for each host and on port 443 so don't need a NameVirtualHost directive. Because I don't have any virtual hosts with *:80, Apache throws up the following warning when I reload/restart:

[warn] NameVirtualHost *:80 has no VirtualHosts

I want to effectively tell Apache "if you've seen a NameVirtualHost *:80 directive already, ignore it" in a configuration file which is included later down the line (after ports.conf). Is this possible? I know I could just comment out the line in ports.conf, but that means editing a file which is supplied by Debian, and I prefer to put customisations in separate files to avoid problems when Apache is upgraded and apt throws up a message saying that the configuration has changed.

link|improve this question
feedback

1 Answer

up vote 0 down vote accepted

Normally, a default site is defined within a virtualhost definition. This catches any request that are not otherwise configured. See /etc/apache2/sites-available/default for an example. This should be symlinked to /etc/apache2/sites-enabled.

In your case the default server should catch nothing, so you may want to set it up to show an appropriate page.

link|improve this answer
I'm aware of the default virtual host, however I don't really want a default page or a NameVirtualHost *:80 directive. – pwaring Oct 8 '10 at 14:33
Then, I believe you have with two options, edit ports.conf, or ignore the warning. I wouldn't expect the configuration engine to add the complexity of turning off options which have been configured. – BillThor Oct 9 '10 at 0:54
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.