[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Virtual Hosts



The original question was about IP based virtual
hosts. These are the settings for name based
virtual host.
Correct, though.

Still I prefer to have the IP in the virtual 
host directive. Reduces DNS traffic somewhat 
and is more reliable as far as I can tell.

Apache by default responds to *all* IPs on port 80,
so you could possibly skip the Listen directives
unless you want some special ports like
Listen 10.0.0.1:443

See
http://httpd.apache.org/docs/mod/core.html#listen
http://httpd.apache.org/docs/mod/core.html#port
and
http://httpd.apache.org/docs/dns-caveats.html

BTW.
Altough you can set a default vhost by
<VirtualHost _default_:*> I didn't find this 
to be very reliable. I usually simply make sure
the *first* vhost entry is somethings "defaulty"
like our company's web page as Apache uses the
first vhost if no server name matches.


Cheers, Marcel



Peter Billson <pete@elbnet.com> 3 Apr 2001, at 13:24:

> > I have installed Debian 2.2r2 and now trying to put
> > more IP based virtual hosts. I have used
> > the VirtualHost directives, and gave the IP number
> > to each site. But when I tried to look on the Virtual host
> > site, it brings the primary site.
> > 
> > I will appreciate, if I get information about how to setup 
> > VirtualHost on 2.2r2.
> > 
> > Abu Umair.
> > 
> 
> Be sure that you have a NameVirtualHost directive before your
> <VirtualHost> and be sure you have your Listen directive set to the
> IP(s)/ports you are listening on
> 
> basically use something like:
> 
> Listen 192.168.1.1:80
> Listen 192.168.1.2:80
> Listen 192.168.1.1:443
> 
> NameVirtualHost 192.168.1.1:80
> 
> <VirtualHost foo.bar.com:80>
>     ServerName foo.bar.com
>     ServerAdmin webgirl@bar.dom
>     DocumentRoot /www/bar
> </VirtualHost>
> 
> NameVirtualHost 192.168.1.2:80
> 
> <VirtualHost www.abc.com:80>
>     ServerName www.abc.com
>     ServerAdmin webgirl@abc.dom
>     DocumentRoot /www/abc
> </VirtualHost>
> 
> You can have multiple VirtualHost directives under each
> NameVirtualHost directive if you want to share IPs between domains.
> You can substitute names that DNS can translate to IPs in the
> NameVirtualHost directives if you prefer.
> 
> This is a very short example and there are a lot more options I would
> add to my virtual domains if I were you.
> 
> Pete
> 
> 
> --  
> To UNSUBSCRIBE, email to debian-isp-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
> listmaster@lists.debian.org
> 




Reply to: