Search This Blog

Tuesday, December 11, 2012

Reverse proxy using apache2

Hi all, once again a step by step instruction on how to make your apache2 software work as a reverse proxy as well.

The steps here are for debian or ubuntu based distro. Replacing some system commands for other distros must give you a similar response.

Step 1: Install apache2

# apt-get install apache2

Step 2: Install modprxoy

# apt-get install libapache2-mod-proxy-html

Step 3: Edit httpd.conf

# nano /etc/apache2/httpd.conf

and paste the following contents

  LoadModule proxy_module /usr/lib/apache2/modules/
  LoadModule proxy_http_module /usr/lib/apache2/modules/
  Include /etc/apache2/proxy.conf

The above step loads modproxy modules into apache2 and includes the reverse proxy mapping file

Step 4: Create a file proxy.conf

# nano /etc/apache2/proxy.conf

and paste the following data (with editting path for your application)

  ProxyPass  /<name to map> http://<host ip>:<port>/<application>
  ProxyPassReverse  /<name to map> http://<host ip>:<port>/<application>

Step 5: Restart apache2

# /etc/init.d/apache2 restart

Thats it your application which was accessed via specific port is now accessible via apache2 default port with the mapped name. :)

No comments:

Post a Comment