2

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

EddyR
  • 171
  • 6

1 Answers1

2

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.

hobodave
  • 2,800
  • 2
  • 23
  • 33