Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created 2 VM's on a single machine for 2 webservers. One server will be running the IIS service and the second server will be running Apache services.

How do I configure my server/router to make 2 different domains work on different servers with a single static ip address.

share|improve this question

If you want to host your web server on the standard HTTP (80) or HTTPS (443) ports, I think you cannot have two different machines answer depending solely on the domain name.

The thing is, when you access some site, you are not accessing it via a domain name - you are just using DNS to map that domain name to an IP. The reason you can host multiple sites on the same IP is the Host header - see section 14.23 Host of RFC 2616:

How this works is the following. Let's say we have two domains and pointing to the same IP, say Client, usually using some Web browser, asks DNS for the IP of DNS replies back with Client then sends something like:


When your web server receives this, it can then determine that you actually want and not (or possibly other virtual hosts on that web server).

In your example, however, you don't have one server - you have two servers. Router would need to route to one of them based solely on the IP - the Host header is processed on the application layer while routing is done on the IP layer (see TCP/IP model). While some routers do some decisions based on the application layer, I don't think any can go that deep into the packet to examine the HTTP headers and route based on that result.

What you can do is:

  • Make one of the two VMs the default and then proxy through to the other one
  • Make a third VM that will proxy to both current VMs

See e.g. this for more information about virtual hosts:

See e.g. these about setting up a reverse proxy:

Here is the reference documentation for the modules that can be used to make reverse proxy:

Hope this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.