Server Fault is a question and answer site for system and network administrators. 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

Lets say I have two domains pointing to my IP: and pointing to

When someone connects to it should go to But when someone connects to I need it to go to

What's the best way to achieve this? I'm using Ubuntu 10.10.

share|improve this question
Can you please better clarify what you are looking to achieve? Is the communication via http(s) or via some other protocol? Also are the domain names CNAME DNS records to each other or are they unique IP addresses? – Red Tux May 2 '11 at 21:18
There's only one IP address. – user76231 May 2 '11 at 22:37
You're 50% there... there's one other question you forgot to clarify on: Is the communication via http(s) or via some other protocol? – Red Tux May 2 '11 at 23:02
up vote 0 down vote accepted

This is not possible.

The domain name gets resolved to an IP address by the connecting client, and the IP communication to the server just contains a request for the port on the IP address that it resolved to. You will have to change your software configuration to find another solution. You either need to programatically make a different request in the first place or have the answering server do some work in the background or perhaps your API can prompt for the domain as part of your chat with the port.

share|improve this answer
Actually, if this is indeed http traffic, a solution could be set up fairly easily using Apache VirtualHosts and mod_proxy. – EEAA May 2 '11 at 21:32
It's not http traffic. – user76231 May 2 '11 at 22:36

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.