Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How to use DNS to redirect domain to specific port on my server

I have 2 public facing web servers on Rackspace Cloud Servers. One is a Windows 2003 server with IIS 6 and the other a Debian Lenny server with Apache2.

Our old website is hosted on Windows and we are developing a new version from scratch on Debian. The Debian box has Staging and Development environments setup on different ports.

In Rackspace's DNS settings I have the domain for the site pointing to the Windows box but I need to redirect the domain if it's on one of the Staging or Development ports. How can I do this?

Also, it doesn't matter which server does the redirection but I have a preference for Apache since we will eventually move everything over to the Debian box.

Thanks

share|improve this question

marked as duplicate by Chris S Jan 26 '12 at 15:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

You need to use a different hostname for your staging and development sites.

DNS has no concept of ports. It simply "maps" a hostname to an IP address and its job is done.

So if your "the site" is located at www.thesite.com you'll see an A record* in your DNS like so:

www.thesite.com.    IN   A    1.2.3.4

*Or possibly a series of CNAME records that eventually references to an A record

I suggest adding records similar to the following:

www.staging.thesite.com.       IN   A    1.2.3.5
www.development.thesite.com.   IN   A    1.2.3.5

Which will point the staging and development sites to your box running Apache. Then you simply configure Apache with name-based virtual hosts so that the appropriate site is loaded based on the hostname used to access the site.

I do not recommend mucking around with multiple ports for your dev and staging sites, it's unnecessarily confusing and addresses a problem that doesn't exist if you're using name-based virtual hosts.

share|improve this answer

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