Simple Way to Use Apache as a Reverse Proxy
Am a developer. As a result, I know a multitude of different programming and scripting languages ranging from Visual Basic to HTML and just about everything between. As a result I do a multitude of projects. Now my main server…. the one I do the most development on is a Ubuntu Linux server… but because I also need to develop for Microsoft technologies, I need to have a Windows Server virtual machine on it.
Since some of these sites I work on need to be run in a windows environment, I also need a way I can still send all my requests to and through my LAMP box, and pass them off to my windows VM residing on it.
I will not go into how I set the VM, #1 it was a nightmare, #2 that is out of the context of this post.
I will however, tell you how I configured Apache to serve all requests for particular sites to pass through to IIS on the VM.
<VirtualHost *> ServerName yourdomain.com ProxyPreserveHost On ProxyRequests off ProxyPass / http://192.168.X.X/ ProxyPassReverse / http://192.168.X.X/ </VirtualHost>
As you can see here, it’s not all that complicated. You swap out yourdomain.com to the domain of the site you want to pass over to IIS, and change the IP addresses to that of your VM. Please make sure your install of apache has the proxy modules enabled before attempting the above.
a2enmod proxy a2enmod proxy_http service apache2 restart