Linux Blog

Reverse Proxy with ModProxy

Filed under: Linux Software — at 3:30 am on Wednesday, February 2, 2011

Reverse Proxy with Mod Proxy

Mod proxy is a versatile module for apache that has many uses. One of its many uses is the reverse proxy feature. Lets say you have multiple web servers behind a router and want to give the outside world access to each server. Your router can only open port 80 for one host, but with modproxy you can direct users to different servers depending on which sub domain or directory they are requesting. This also works for external sites that may not be on your private network.

Hit the jump to see how.

To do this is quite simple:

<code>ProxyRequests Off</code>
<Proxy *>
Order deny,allow
Allow from all
ProxyPass /foo
ProxyPassReverse /foo

Example from:

Basically when some one requests /foo on your web server that the public port 80 points to, it proxies the request to The reverse is to make sure that the requests come back to the user that requested it. As the documentation states you should secure your servers before using mod_proxy which is probably a wise choice, but you should always secure your servers.