LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: LVS to Hostname

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: LVS to Hostname
From: "Bill Omer" <bill.omer@xxxxxxxxx>
Date: Wed, 20 Dec 2006 09:19:47 -0500
You can use the VirtualHost option in Apache.  That will display what
ever website based on the hostname.  The IP must resolve to the VIP of
course.

Example httpd.conf:

<VirtualHost 202.43.87.2>
       ServerName abc.com
       ServerAlias www.abc.com
       DocumentRoot /home/abc.com
       ServerAdmin admim@xxxxxxx
       ErrorLog logs/abc.com.error.log
       CustomLog logs/abc.com.access.log common
</VirtualHost>

<VirtualHost 202.43.87.2>
       ServerName xyz.com
       ServerAlias www.xyz.com
       DocumentRoot /home/xyz.com
       ServerAdmin admim@xxxxxxx
       ErrorLog logs/xyz.com.error.log
       CustomLog logs/xyz.com.access.log common
</VirtualHost>


abc.com and xyz.com both resolve to the same ip (the VIP) and apache
will know what page to display based on the hostname.


Sorry for not understanding your question the first time.


On 12/20/06, Graeme Fowler <graeme@xxxxxxxxxxx> wrote:
Hi

On 20/12/2006 09:10, Kalpin Erlangga Silaen wrote:
> Is it possible to make LVS listen only for hostname and not for IP ? For
> example, I was create LVS and work very well with VIP 202.43.87.2 and I
> have setup www.abc.com to this IP. Now, I just want allow people to open
> http://www.abc.com. If they open http://202.43.87.2 they will redirect
> to other site ?

The answer to the first question is "no".

The answer to the second question is "it depends".

LVS is a router. It is not application aware. In your case, if you had
(for example) only one website on your realservers with hostname
www.abc.com, and this was the default site, then going to the IP address
will display the site for www.abc.com.

If you configure your webserver appropriately, you can do all sorts of
things depending on the host visitors request. This is, however, all
done at the webserver and not via LVS.

Graeme
_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to http://www.in-addr.de/mailman/listinfo/lvs-users


<Prev in Thread] Current Thread [Next in Thread>