Home Apache as a reverse proxy
Post
Cancel

Apache as a reverse proxy

Instead of opening a bunch of ports to my home network, i figured it was easier to setup a reverse proxy for all the servers in my home. Heres a quick run down on how to do it.

First we have to enable the proxy modules in apache then restart apache.

1
sudo ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled
1
sudo ln -s /etc/apache2/mods-available/proxy_http.load /etc/apache2/mods-enabled
1
sudo /etc/init.d/apache2 restart

Once that is complete we need to create the apache config we will be using.

1
sudo vim /etc/apache2/sites-available/proxiedhosts

Here is an example of one host in my network, you need to add your hosts like this.

1
2
3
4
5
6
7
8
9
<VirtualHost *:80>
ServerName test.home.x.me
ProxyPass / http://192.168.x.x/
ProxyPassReverse / http://192.168.x.x/
<Proxy http://192.168.x.x/>
Order Allow,Deny
Allow from all
</Proxy>
</VirtualHost>

All you need to do is change the “ServerName” to that of the address you are coming in to and obviously the IP address.

There are a couple of situations where you need to additional options, running JIRA behind a reverse proxy is one of them. Here is a copy of my JIRA proxy config.

1
2
3
4
5
6
7
8
9
10
11
12
<VirtualHost *:80>
ServerName jira.home.*.me
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://192.168.*.*:8080/
ProxyPassReverse / http://192.168.*.*:8080/
<Proxy http://192.168.*.*:8080/>
Order Allow,Deny
Allow from all<
</Proxy>
</VirtualHost>

Note that additional “ ProxyRequests Off” and also the “ProxyPreserveHost On”

This post is licensed under CC BY 4.0 by the author.