Two servers on one WAN IP load balancing

I want to make two servers on one WAN IP load balance on just port 80 if possible (not needed but would be nice). Also can I assign one website to each server e.g. www.example.com goes to server 1 and www.example.co.uk goes to server 2 and www.example.net is load balanced between them. Thanks in advance.

MacBook Black 2.4GHZ 2GB RAM, Mac OS X (10.5.8), Mac Mini G4 1.5GHZ 1GB RAM - Leopard Server, iPhone 3G[S] 16GB Black

Posted on Jan 7, 2010 6:14 AM

Reply
5 replies

Jan 7, 2010 6:29 AM in response to bestcallumuk

Easiest: set up both boxes with DNS host name translations from the same name; if you "dig" google or other or such domains, you'll see multiple host IP addresses returned via DNS.

If you want to have load balancing with finer granularity than DNS cache times or that can target specific IP traffic, you'll need to install network box "in front" of your servers that provides the http load balancing; a "load balancer" or such. These devices are available from various sources.

Jan 7, 2010 8:14 AM in response to bestcallumuk

What are you optimizing your environment for here, other than the fewest possible boxes and the fewest IP addresses and probably the lowest cost? Where do you want to get to?

You can't "fork" IP packet traffic and perform the requested load-balancing and the single web-facing static IP (this requirement from the early part of the discussion thread here) without some sort of load-balancing, or without a reverse proxy. The IP address has to be routed to a network box somewhere, and that box somewhere has to decide where the packet should be forwarded when you're seeking for load-balancing or failover.

If you have two sites and two public DNS domains and you want that to go to one static IP address and then load-balance to two servers, then you need some add-on network hardware. That load balancer can be a Linux box or a commercial appliance, running nginx or any of various other software. That load-balancing box accepts the incoming IP traffic, peeks at and finds http traffic and then the target domain, and forwards the request appropriately. As a general rule, IP routers don't peek that far into the network packets.

Now if you have two domains and two web sites and two public DNS translations that you want both going to one IP address and one host server, that's feasible. That's virtual hosting.

Or if you want one box to forward some web requests through to the other box, that's entirely feasible, but that also tends to be a case of "why bother" as you're loading up two boxes, and your web environment is entirely dependent on the "reverse proxy" box accessible and working. Mac OS X Server does have reverse proxy, which is what can have one web server serve through contents from another box.

Or you get a couple of more static addresses.

Regardless, Mac boxes (and most any other box running a multi-processing operating system) make for very expensive and slow IP routers.

Jan 11, 2010 10:50 AM in response to MrHoffman

How would I set up reverse proxy? How can I set it up so that there is server 1 which is directly connected to server 2 so that all the connections go to server 1 and it keeps 25% of the load and shares the remaining 75% of the users to server 2. I have tried playing around with reverse proxy but can't figure it out. Sorry, I'm a bit of a beginner to servers.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Two servers on one WAN IP load balancing

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.