Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

3 Answers

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 webmaster@site1.net
  ServerName www.site1.net
  ProxyPass / http://local_site1_server/
  ProxyPreserveHost on
</VirtualHost>

Then

sudo a2ensite site1
sudo /etc/init.d/apache2 restart
share|improve this answer
add comment

Yes, there are a number of Linux web servers and proxy servers that can act as reverse proxies, sending page requests to different servers based on the host name in the http request. I'd recommend taking a look at nginx.

share|improve this answer
    
Apache can also act as a reverse proxy. –  lmontrieux May 11 '11 at 11:17
    
Be careful when setting up your reverse proxy. More open proxies have been enabled on the web by not having the configuration audited by someone that knows best practices. While this may not be inherently bad, it opens up possibilities for mischief using your proxy. –  lazyPower May 11 '11 at 11:19
add comment

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.

share|improve this answer
add comment

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.