Reverse proxies are used to hind web servers. This allows one web server to provide content from another perceptibly. This is great to set up an additional layer of protection for sensitive data. If you have a server that has sensitive information, this allows you to set a proxy outside of a firewall as a replacement for your content server. When outside clients try accessing the content, they are set to the proxy server instead. Leaving the real content on your server safe in the firewall.
1. First you need to install apache:

sudo apt-get install apache2

To test if apache installed correctly go in your browser and type localhost/ you should see it works!
Skip to step 3 if you have apaches installed

2. if for some reason you uninstalled apache and then tried re installing it and ran into issues run this:

sudo apt-get install apache2 apache2-mpm-prefork apache2.2-common libapache2-mod-php5 php5

If you run into PHP or Apache issues:

dpkg-reconfigure php5

dpkg-reconfigure apache2

3. now that we have apache installed we need to activate a few modules:

a2enmod ssl

a2enmod proxy_http

4. Now edit your default file

vim /etc/apache2/sites-available/default

or

gedit /etc/apache2/sites-available/default

5. Now at the end of the file go add something similar to this

<Location /example>

order deny,allow

deny from all

allow from all

ProxyPass https://http://www.example.com

ProxyPassReverse https://http://www.example.com

</Location>

The <Location /example> is the location of your new access. so when you go to localhost/example on you local host you will see the contents of http://www.example.com, but with a localhost/example url.

6. Now restart to update:

/etc/init.d/apache2 restart

Now you have a reverse proxy running of your own site. As you may notice pictures may not be viewable. This is because of the way the site was written. Images need to have full paths not just /image.png. Also clicking other links will not show up under the reverse proxy. This is due to only setting it to one URL.

Advertisements