Issues Setting up a reverse proxy in Apache

Pete picture Pete · Apr 6, 2009 · Viewed 26.4k times · Source

My roommate and I each have a separate webserver we are trying to set up. We are trying to use mod_proxy so that his server will forward requests to my machine (we have two seperate machines behind one router) based on the server name. I've given the basics of what we have in our apache config currently but we are getting a 403 Forbidden error when trying to access the second domain (the first, www domain, works fine).

NameVirtualHost *:80

<VirtualHost *:80>
 DocumentRoot /var/www
 ServerName www.<domain1>.com
</VirtualHost>

<VirtualHost *:80>
 ProxyPreserveHost On
 ProxyPass / http://<IP addr of other box>:80
 ProxyPassReverse / http://<IP addr of other box>:80
 ServerName <dummydomain>.gotdns.com
</VirtualHost>

Answer

Jeremy Stanley picture Jeremy Stanley · Apr 6, 2009

Your mods-enabled/proxy.conf might be blocking any proxy requests (it's deny all by default). It should include the following instead:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

EDIT: Also make sure that the mod_proxy submodules are sym linked into mods-enabled (in this case, the http sub module which is mods-available/proxy_http.load)