Saturday, January 29, 2011

How to host many websites using same public IP address but different domains.

I know how to configure one IIS instance to run many websites using the same public ip address, but different domain names (As long as I have control over the domains).

But how can you configure many IIS servers running on different virtual machines in the same network, to host websites using the same public IP addres, but different domain names?

Normailly in IIS under the website you can set the headers to which the website will respond to. but what if that website is on a different machine?

Edit:

Let me explain better. Pretend that you have only one public IP address that you can use to serve up websites. You want to expose multiple websites under that same IP address, but the websites live on different physical machines, within your network.

  • You could add a local DNS server and point the XXX.domain.com to the appropriate IIS server.

    John Gardeniers : Better read the question again. He wants to host it all on one IP address.
    From fergNab
    • Point all domains to the same IP address, obviously

    • In IIS (which version?) set up multiple websites. In the bindings (where you attach them to ip addresses) you can set the HOST HEADER. Put in the domain there.

    This way when a request comes for address X, IIS can separate them ou tdepending on the host header (www.serverfault.com etc.). The browser sends the requested domain in a field named "Host Header" to the server for exactly this reason.

    References:

    http://support.microsoft.com/kb/308163

    And, with a lot of background:

    http://www.gafvert.info/iis/article/understanding_host_headers.htm

    Roberto Sebestyen : THanks tom. But I know how to do this. What I meant was if the websites are on different physical servers internally on your network, but you have only one public IP address to use for serving websites.
    TomTom : Then you need a reverse proxy - I basically do the same, using Microsoft TMG (Thread Management Gateway), basically a firewall. There I can publish internal websites - it creates a listener and forwards the requests. Can do the same also for SSL. Without additional software Windows does not have these capabilities. Decent software for this includes IIRC Squid (Linux / Free) in reverse proxy mode, and the mentioned TMG (Thread Management Gateway).
    John Gardeniers : Apache also makes a fine reverse proxy.
    TomTom : And a cheap one, too. Agreed - good choice.
    From TomTom
  • You can do this with a load balancer or with Microsoft's Network Load Balancer (NLB).

    NLB can take 1 IP and listen on that IP on multiple servers (it may take some network changes depending on your network).

    However, I recommend the load balancer approach. If you're using IIS7, then use Application Request Routing (ARR). It's a tiny add-on to IIS 7 and works as a reverse proxy. Have the IP live on your 'front end' node and it will act as a reverse proxy to get the requests from the other servers. The other servers (front end node too) will all need to have internal IPs.

  • A word of caution, though... if any of them are SSL secured, this is going to cause you problems depending on the proxy you use. If all it does is inspect the host header and forward the traffic, it won't work because the host header is part of the encrypted portion of the traffic.

    J.Ja

0 comments:

Post a Comment