Proxying a page/website through Apache

Posted by Benjamin Close on November 8, 2008 under Computers, OpenSource | Be the First to Comment

Sometimes you want to expose one port in your firewall but not another. However, often you have different servers running on different ports. Apache has the ability to proxy pages, this allows one server to be externally visible with the other running only locally. It allows you to secure one server and only open one port to external attacks. To setup this proxying put the following in your apache config file:

    RewriteEngine on
    RewriteLog /SOMELOGFILE
    RewriteLogLevel 2
    RewriteRule ^/(.*)$ http://localhost:8180/$1 [P]
    ProxyPassReverse / http://localhost:8180/

The above will proxy the entire domain to the server on the same machine running on port 8180. The [P] tells apache to use the proxy module to do the work. This is not a redirect but a proxy so it hides the internal URL with the external facing one. The ProxyPassReverse directive tells apache to do the rewrite of the URL to remove the localhost:8180 bit back to the originating url



Donations keep this site alive

Add A Comment

*