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:


                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).

5 responses to “Debian/Ubuntu & Apache 2: Transparent reverse proxy with mod_proxy”

  1. Thank you for the quick and simple outline of doing this in Debian. I did find a typo… to restart Apache on my machine at least it is
    sudo /etc/init.d/apache2 restart

  2. Hi Jan.
    I do as your instruction but it not works for me.
    I have a public domain name point to a static ip from my ISP. I config the modem to point all request from port 80 to a local machine through NAT.

    Now i want to have 2 sub domain to point to 2 different IP: –> –>

    So i try to use proxy module of apache2 in but not succeed.
    Do i think right? Can you please help me?

Leave a Reply

Your email address will not be published. Required fields are marked *