How to set up Reverse Proxy in Apache/httpd

Install and enable apache2 proxy modules

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo systemctl restart apache2

proxies all requests (“/”) to a single backend:

ProxyPass "/"  ""

to point to the reverse proxy, instead of back to itself, the ProxyPassReverse directive is most often required:

ProxyPass "/"  ""
ProxyPassReverse "/"  ""

Only specific URIs can be proxied

ProxyPass "/images"  ""
ProxyPassReverse "/images"  ""


<VirtualHost *:80>

Documentroot /var/www/html/

ProxyPass "/"  ""
ProxyPassReverse "/"  ""


Leave a Reply

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