One IP address, Two Websites, on Two Machines

I want to setup multiple (currently two) websites hosted on two different machines, using one external IP address. Each of these websites will be on different sub-domains or domains.

Is there a way I could leverage Ubuntu server to ask as my entry point into my network (after my firewall) to direct traffic the the appropriate machine based on host header of some of means? I've done this in the past with Microsoft Proxy Server/ISA. Microsoft called this feature "reverse-proxy".

Thanks so much for your help

Matt


You can instlall Apache and set it up as a reverse proxy:

sudo apt-get install apache2
sudo a2enmod proxy proxy_http

Create an /etc/apache2/sites-available/site1 with the following contents:

<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName www.site1.net
  ProxyPass / http://local_site1_server/
  ProxyPreserveHost on
</VirtualHost>

Then

sudo a2ensite site1
sudo /etc/init.d/apache2 restart

You can setup a reverse-proxy using different tools such as Apache. You have to remember that in order to have multiple servers behind a single IP address, you need a couple of things: - a unique, local, IP address for each server behind that unique IP address - a way to uniquely distinguish the incoming traffic and redirect it appropriately

The traffic can be redirected based on different things that a reverse-proxy can handle: - The source IP address - The actual port used on the destination IP address (you) - for HTTP/HTTPS, you can also redirect based on the hostname part of the HTTP[S] header.

The third is probably the one you want to use, unless you are ready to advertise some web services running on a non-standard port.

And of course, Security is always the priority and your setup should be either verified by an expert, or go through a deep scan to ensure it is not vulnerable to attacks. Keep your reverse-proxy or firewall software up-to-date at all time.