+1

Reverse Proxy In Ubuntu

Flex, CFML, Adobe, ColdFusion, Microsoft, Linux

The last few days I have spend some time setting up 2 new servers.  One running Railo on Ubuntu and the other Coldfusion in Windows.  I needed to host this on a single IP address and needed both machines available on the internet.   There are 2 ways I know of that can accomplish this task 1.  Using Microsoft ISA and 2 Using Apache as a reverse proxy.  As I already have Apache up and running I went with option 2.

While a seemingly trivial task I had never done this before and got hung up a few times the following are the steps I took:

Define the urls you want to re-direct to a different server:

<VirtualHost *:80>
    ServerName www.myExternalDoomianName.com
    ProxyPass / http://myInternalDnsName/    ( or ip address )
    ProxyPassReverse / http:// myInternalDnsName /  (or ip address )
    ProxyPreserveHost on
</VirtualHost>

ProxyPreserveHost keeps the host headers intact so the internal sever can still use virtual websites.
Then run:
A2ensite myReverseProxySites
Need some extra bits for apache.
apt-get install libapache2-mod-proxy-html
a2enmod proxy
a2enmod proxy_html
a2enmod headers
a2enmod proxy_connect
a2enmod proxy_balancer
Restart apache
/etc/init.d/apache2 restart
If something isn’t working start looking in the logs:
tail -f  /var/log/apache2/error.log


Search