2

I have a single ESXi 5 server which is connected to a single IP address. Within this server I have created 2 VMs:

  1. Windows 2008 IIS Web Server (a.site.com)
  2. CentOS Apache Web Server (b.site.com)

I am unsure of how to route traffic to the correct VM based on the host header?

5
  • they listen on different ports, I think Oct 26, 2011 at 15:24
  • What device or software is going to do the routing? Oct 26, 2011 at 16:11
  • @David can the ESXi server itself do the routing? I've got no idea to be honest.
    – user35072
    Oct 26, 2011 at 18:14
  • I don't know of any web routing software that runs on ESXi itself. Something is going to have to receive the connection, look at the 'Host' header, and then either redirect or proxy the returned page. Oct 26, 2011 at 18:32
  • 1
    Vote to move to Serverfault.
    – BBlake
    Oct 26, 2011 at 19:27

2 Answers 2

1

You need to put a reverse proxy on the host machine (or on one of the VMs to which you'll route all requests), which will internally forward requests to individual VMs based on the host header. Both VMs must be accessible from the host machine on a specific IP address or port.

As for the reverse proxy - one option is Apache with mod_proxy, Nginx is a lightweight alternative. According to this post, nginx can be configured as a reverse proxy which works based on Host value as well.

(Disclaimer: I didn't do this practically myself.)

1
  • 1
    Async servers like Nginx and Varnish that were largely designed to reverse-proxy are great fits here, but the lightest-weight (not necessarily fastest) option would definitely be to piggyback on the existing Apache instance and proxy some subdomains to the IIS host. Oct 27, 2011 at 17:35
0

I have done this with IBM HTTP Server (IHS) which I don't believe is free, but my favorite GPL version of a reverse proxy is Pound (www.apsis.ch/pound/). Check out the section "Virtual Hosts (In General)" on that page. I believe this is what you are looking for. Below is a slightly tweaked version of the config from that page...

 ListenHTTP
            Address 1.2.3.4
            Port    80

            Service
                HeadRequire "Host: .*a.site.com*"

                BackEnd
                    Address 192.168.0.10
                    Port    80
                End
            End

            Service
                HeadRequire "Host: .*b.site.com.*"

                BackEnd
                    Address 192.168.0.10
                    Port    80
                End
            End
        End

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .