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

I have three separate web servers with three different internal IP addresses on a network with only one public IP address. Each web server has security restrictions such that I cannot just run all of my websites on a single web server. All are running Apache.

I want to setup subdomains that allow me to access each of the different web servers remotely, all on port 80. E.g.,

site1.domain.com

site2.domain.com

site3.domain.com

Where all three of those domains resolve to my single public IP address, but some type of service examines the request to see which subdomain is being requested and pulls the data from the appropriate server.

Is this type of thing (1) possible and (2) easy to implement? I'm running Ubuntu Server 9.04.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

This is called Reverse Proxy, you can redirect all trafic on port 80 to one Apache server, configure 3 vhost (1 per subdomain) and in the 2 vhost handling non local website use the Apache ProxyPass directive to tell apache to load content from another server.

nginx can also act as a reverse proxy. You can forward all request to nginx then nginx will load content on one the right server depending of the subdomain.

I would use the Apache proxypass feature, it's easier to setup from my point of view.
You can also start a 4th apache server that will only act as reverse proxy. In this case all of the 3 vhost will use proxypass to get content from the right server.

See http://www.raskas.be/blog/2006/04/21/reverse-proxy-of-virtual-hosts-with-apache-2/ for an example, you case is the same execpt that you have a third subdomain (so you need 1 more vhost).

share|improve this answer
    
This is great! Thank you so much. –  Kirk Aug 18 '09 at 23:34

Your Answer

 
discard

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.