Debian/Ubuntu & Apache 2: Transparent reverse proxy with mod_proxy

Here is a tutorial how to use the apache module mod_proxy to set up a transparent reverse proxy that passes all requests to another web server.

Under Debian or Ubuntu you have to enable the modules proxy and proxy_http:

# sudo a2enmod proxy
# sudo a2enmod proxy_http

A use case for a transparent proxy is to route all requests to a public domain ( in the example) to a private (hidden) domain ( in the example), e.g. to hide the complexity of your domain/server structures. The virtual host configuration looks as follows:

<VirtualHost *:80>
        <Proxy *>
                Order deny,allow
                Allow from all
        ProxyPass /
        ProxyPassReverse /

After restarting the apache the proxy modules and your host configuration should be active:

# /etc/init.d/apache2 restart

If you find the following error message in your web server’s error log file (/var/log/apache2/error.log)

[warn] proxy: No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

you do not have to enable the module proxy_http (see above).