Reverse Proxy setup in Apache2 Ubuntu

I am running an apache server to serve a simple landing page say I am also running a play app server at port 9000 which I want to make it accessible by URL Below steps will tell what needs to be done to get this working in a Ubuntu server.

1. I use AWS Route53 for DNS. So I added a CNAME record for to Please note specifying port numbers in Route53 will not work.

2. In Ubuntu 12.04, Apache2 default location is under /etc/apache2/. I wanted to set up a reverse proxy – that will direct requests to to apache2 itself and requests to to port 9000. Before setting up reverse proxy we need to enable the required modules. This can be done by using a2enmod command.
then, enter below modules:
    proxy proxy_ajp proxy_http rewrite deflate headers proxy_balancer proxy_connect proxy_html
For me proxy_html was not installed, but not having this did not cause issues. I think proxy and proxy_http are the main modules required.

3. Next step is to edit the cofig file. Apache2 doc states the config file is httpd.conf, but in Ubuntu you could simply use

4. The above file already had an entry for the default virtual host as below:
    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www
The ServerName entry was added newly by me.

5. I added another new Virtual host entry for like below:
    <VirtualHost *:80>
    ProxyPreserveHost On
    ProxyRequests off
    ProxyPass /
    ProxyPassReverse /
Give a proper URL with port number for ProxyPass and ProxyPassReverse.

6. Reload Apache2 and check!
     sudo service apache2 reload


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s