apache virtual host problem

Derek Broughton news at pointerstop.ca
Mon Feb 4 15:56:08 UTC 2008


Ashley Benton wrote:

> Sorry I have NameVirtualHost 192.168.0.105 on the first line and
> <VirtualHost 192.168.0.105 > on the second line.
> Meg

Karl's leading you astray...

One only needs NameVirtualHost to specify an IP if you have multiple
interfaces to the Internet.  For this, and almost certainly for your
production version, you want:

NameVirtualHost *

<VirtualHost *>
   ServerName example.org
   ...
</VirtualHost>

<VirtualHost *>
   ServerName another.org
   ...
</VirtualHost>

>From your original mail:

> I tried to add the following lines in /etc/apache2/http.conf
> ServerName localhost
> ServerName www.example1.com
> ServerName www.example2.com
> ServerName www.Example.org

That's bad :-)  You want the ServerName directives for each virtual host
_only_ within the <VirtualHost> definition.

(and we don't ever modify http.conf! - put each virtual host config in a
separate file in /etc/apache2/sites-enabled)
-- 
derek





More information about the ubuntu-users mailing list