Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

Currently there is one external IP pointing to a Window Web Server. Now wish to add a Linux web server. Wish to know if the following setup is ok : points to Window Web Server points to the new additional Linux Server.

If the above scheme is ok, then how should it be done. (In terms of where the router should be placed and configured etc).

If the above scheme is unusual or not workable please suggest best practice scheme.

Hope somebody knowledgable could help ...

share|improve this question
Communication needs to be routed to two different ports if you have two different servers on the exact same external IP. e.g. for Server A and for Server B – sajawikio Nov 16 '12 at 4:28
If there are 2 different ports, then how an external user can access the content of the 2 different servers ? Do they have to include the port number in the URL? – Stanley Nov 16 '12 at 4:32
Yes they do - but there is a way where they DON'T have to put port number, even using the same IP just on port 80 (i.e. practically without specifying the port number in the URL) - this is probably what you want - see my answer I put some more detail abut this. – sajawikio Nov 16 '12 at 4:45
up vote 2 down vote accepted

Communication needs to be routed to two different ports if you have two different servers on the exact same external IP. e.g. for Server A and for Server B

If you don't want the end user to put and you want to have both servers on port 80 - it must be done like this: use an internal proxy that listens on port 80 and forwards incoming requests based on subdomain or domain to the correct "internal" ip of each of your two servers (or "x" number of servers, for that matter).



  • is the PORT 80 LISTENER
  • for Server A and
  • for Server B

So set it up like this:

  • on port 80 (
  • goes to port 80 ( and will internally route request (not redirect, but internally route transparently) to based on subdomain saying "serverA"
  • also goes to port 80 (, routes transparently to based on subdomain saying "serverB"
  • all other requests are handled by the router however you weant - they can be rejected and return 404 for instance (e.g. or return 404 error because it does not match any definition in the proxy table).

NOTE: For the above, you actually ARE working on - well, then the proxy table definitions should all say for instance:

  • -->
  • -->
  • default -->

By routing transparently the end user does not know that the communication is routed - it is happening on the server side without end user knowing - only YOU knowing. You can do this with node-http-proxy for Node.js - you can do it with nginx - you can do with with most servers out there - look up how to internally proxy requests in the docs for your server of your choice.

If you have to use the same port you will need to use two different IP addresses e.g. for Server A and for Server B

share|improve this answer
Thanks for the answer. Including a port number for the URL is ok. But how should the machine be physically connected and the port number configured ? – Stanley Nov 16 '12 at 4:46
Also if the URL does not contain a port number, does it go to port 80 by default ? – Stanley Nov 16 '12 at 4:47
yes. no port num --> port 80. So the proxy listener server should be on Port 80 so the end user hits it, exactly – sajawikio Nov 16 '12 at 4:49
so goes to port 80. ALSO GOES to port 80, and it will always looklike it to the end user (which is good) but if you configure your router to check your URL's and internally proxy requests, you can get what you're trying to do, and it will still look like it's coming from the same IP (well because it is) but it may be from a different server for each subdomain or even each directory if you want, even all looking like coning from the same port 80 – sajawikio Nov 16 '12 at 4:51

since you need to install a router and you do not have enough public addresses to assign one to each server, you will need to define an internal network so the two servers can talk to each other, and access the public connection.

unfortunately HTTP servers assume that redirect urls are public, so a 30x redirect would just ask the client browser to access the other host. since your linux server is only accessible inside your lan, the client would get a a url they couldn't use and a server not found.

consider using NAT, and forwarding a TCP port (or more than one if you have additional services) to the services on each internal server. you can only use each port once, but if IIS has tcp/80, you can assign apache or nginx port 81. it does mean that clients would have to enter to access the service. you can use dns to cover that up however. you could even use that url to 301 redirect to your linux server.

once you get your router, look at for your model of router to learn how to use NAT to forward traffic to a port.

share|improve this answer
Thanks for the answer, having to include the port number in the URL is ok. But how should the router or servers be configured in order to user the specific port number ? – Stanley Nov 16 '12 at 4:42
that one is really easy, just login to your server at, start the processes or modules on your server at, and make sure to configure each of them to listen as follows: one module on and the other module on for instance, and then go back outside your server and type your external IP and and voila you have two servers on two ports there. – sajawikio Nov 16 '12 at 4:54
You mean I only need to make changes to the first (old) server. But seems we need to do something in Server B too to make it listen to port 9001. Do you agree ? – Stanley Nov 16 '12 at 4:59
Yes you will need to do that. So for example (assuming that the servers are both located at point the Windows Server to and then the linux one to, start them and you should be able to access them from ips and respectively – sajawikio Nov 16 '12 at 5:01
Just checked that is assigned as Internet host loopback address. But what do "/8" and "loopback address" mean ? – Stanley Nov 16 '12 at 5:12

You must log in to answer this question.

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