Re: Load balancing multiple virtual hosts on 1 IP
On Sunday 01 February 2009 19:33:38 Marc G. Fournier wrote: > Thank you for all the responses ... turns out the solution was simplier ... > I tried the various solutions presented, and each of them did the same > thing ... > > The setup I have, I'm using csync2 to maintain the file systems on each > backend, and in order to simplify that, I'm using: > > > > instead of > > > > which works fine ... *but*, something gets confused when you mix-n-match > the above ... its either all of one or the other, but not both ... once I > fixed my config files, the pages now load consistently ... I'm assuming you also have: NameVirtualHost * http://httpd.apache.org/docs/2.2/mod/core.html#virtualhost Addr can be: - The character *, which is used only in combination with NameVirtualHost * to match all IP addresses; -- Mel Problem with today's modular software: they start with the modules and never get to the software part. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Load balancing multiple virtual hosts on 1 IP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thank you for all the responses ... turns out the solution was simplier ... I tried the various solutions presented, and each of them did the same thing ... The setup I have, I'm using csync2 to maintain the file systems on each backend, and in order to simplify that, I'm using: instead of which works fine ... *but*, something gets confused when you mix-n-match the above ... its either all of one or the other, but not both ... once I fixed my config files, the pages now load consistently ... Thank you all for the help on this, the pointers to the other software(s) provided "proof" that it wasn't the software, but my configuration ... - --On Saturday, January 31, 2009 13:55:08 + Matthew Seaman wrote: > 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?/ > > This is certainly possible -- most of the world's big web sites work in > exactly this way, although they would tend to use dedicated hardware LB > if they were of any appreciable size. > > I think what's going wrong for you is that you are using a front-end proxy, > and it's rewriting the requests with the host names of the real servers, > which will certainly screw up name based virtual hosts. > > Instead of ha-proxy, look into relayd -- in conjunction with a pf(4) > firewall this will do exactly what you want. It can operate purely at the > IP level or even at layer 2 if you want to implement DSR. Another > alternative to consider is varnish, although I'm not sure that has much > in the way of health-checking the back-end servers behind it. varnish > is a reverse-proxy / web accelerator so can give you some performance > boost as well. > > Cheers, > > Matthew > > -- > Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard > Flat 3 > PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate > Kent, CT11 9PW > - -- Marc G. FournierHub.Org Hosting Solutions S.A. (http://www.hub.org) Email . scra...@hub.org MSN . scra...@hub.org Yahoo . yscrappy Skype: hub.orgICQ . 7615664 -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkmGd6IACgkQ4QvfyHIvDvOlzwCfT5CpD8LdE4MlMD4ugmjP8tTC Z0YAoOl6F83j4t4WqTFqfQVutKLMQUj1 =fEn7 -END PGP SIGNATURE- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Load balancing multiple virtual hosts on 1 IP
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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Load balancing multiple virtual hosts on 1 IP
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?/ This is certainly possible -- most of the world's big web sites work in exactly this way, although they would tend to use dedicated hardware LB if they were of any appreciable size. I think what's going wrong for you is that you are using a front-end proxy, and it's rewriting the requests with the host names of the real servers, which will certainly screw up name based virtual hosts. Instead of ha-proxy, look into relayd -- in conjunction with a pf(4) firewall this will do exactly what you want. It can operate purely at the IP level or even at layer 2 if you want to implement DSR. Another alternative to consider is varnish, although I'm not sure that has much in the way of health-checking the back-end servers behind it. varnish is a reverse-proxy / web accelerator so can give you some performance boost as well. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW signature.asc Description: OpenPGP digital signature