From owner-freebsd-questions@FreeBSD.ORG Sat Jan 31 23:11:33 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73D6C106575C for ; Sat, 31 Jan 2009 23:11:33 +0000 (UTC) (envelope-from gfritz@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.175]) by mx1.freebsd.org (Postfix) with ESMTP id 421298FC14 for ; Sat, 31 Jan 2009 23:11:33 +0000 (UTC) (envelope-from gfritz@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so989407wfg.7 for ; Sat, 31 Jan 2009 15:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=W/blu4lfPxHe1H8fbIyHbM9IU2Ro/LYXjuoayitsDTY=; b=TOWjGjT8uCK0Wr4bMW1AJfqFPNz4RDoV0fGOYkzcQshVkH64f8MyYDFqg4R4+EjPun 0HzyUSlyMJ60NWhBKY/LugE1emE/k130WVm8v1UvE612U5eYyEBAf6EDL1m8bb+A7UOy AHnLo5sAq8t0W6XoOtT9yCaQITmCygXnwNY2Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=SVpJoCQkXYpbVEO14ay8omMzOQ0YnKgMVNee9jrnYvXvr2mUkzrkSg22/yJfQqYMxK AGapfVSPvzZAOgqC7PJdCwg7KSujsDH1vmkW0GIcXcQDwTUvuZAxI56/CEU8KfKfoOVO qNbo1gHD9xwGjrk2CuMoYuStP3uWuruIj3F9E= Received: by 10.142.158.3 with SMTP id g3mr1126010wfe.333.1233443492657; Sat, 31 Jan 2009 15:11:32 -0800 (PST) Received: from dev.null (98-12-66-208.dsl.cust.wirelessbeehive.com [208.66.12.98]) by mx.google.com with ESMTPS id 30sm4668528wfd.44.2009.01.31.15.11.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 31 Jan 2009 15:11:32 -0800 (PST) Received: by dev.null (Postfix, from userid 1002) id D77F1568; Sat, 31 Jan 2009 16:11:30 -0700 (MST) Date: Sat, 31 Jan 2009 16:11:30 -0700 From: Geoff Fritz To: "Marc G. Fournier" Message-ID: <20090131231130.GA76562@dev.null> References: <20090131091825.R90262@hub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090131091825.R90262@hub.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-questions@freebsd.org Subject: Re: Load balancing multiple virtual hosts on 1 IP X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Jan 2009 23:11:33 -0000 On Sat, Jan 31, 2009 at 09:23:36AM -0400, Marc G. Fournier wrote: > > Simple: is it possible? > > I have two VMs that contain the same content, on two different IPs .. I > want to setup a third VM with something like haproxy on it that will take > the URL (http://domain1) and pull the content from one or the other ... > > So far, all works well if I only have one virtual host, but as soon as I > add a second one (http://domain2), when I try to go to http://domain2, it > pulls up the content for domain1 also, as if I was going to http://IP > instead. > > Is there a way to set this up (with haproxy, or some other software), that > it will actually pass the URL through to the backend apache server and > load up the right content? Or is this a limitation in the protocol > itself?/ Sounds like your front end is messing up the request. If the back end servers get the correct domain in the host header, they should do the right thing and return the data from that domain. As for alterntatives... I have used "pen" for simple load balancing of web servers, and it does what you need. Very minimal and simple. Apparently, Slashdot uses "pound" for their load balancing, so it should do the trick, too. On the slightly more complex side, I've recently starting using "varnish" to split work between Apache and nginx (all three running in the same jail, thus all bound to the same IP address). It is capable of doing what you need, but it's main purpose is a reverse caching proxy, so a bit more care would be needed if you don't actually want stuff cached. All three (pen, pound, and varnish) are in ports. -- Geoff