Virtual hosting and mod_proxy forwarding of different domains (httpd)
Archive - Originally posted on "The Horse's Mouth" - 2009-03-01 09:43:45 - Graham Ellis
The main server is Apache httpd (I had it on 192.168.200.214 - see diagram) and it was serving a domain called "devizes". [technical note - devizes.wellho.net or something fully qualifies when you take this out to the internet!]. However, I wanted to add the domains "lavington" and "urchfont" to it, with parts of the Lavington domain forwarded to another server on the same machine, and the entire Urchfont domain forwarded to another machine - 192.168.200.215.
Using Apache 2.2.x, I uncommented the virtual host support line in httpd.conf, and configured the virtual host file in the extra directory ... using mod_proxy to forward my traffic. The Virtual host configuration file, with lots of extra annotation, is available here.
Notice that is doesn't matter what the background servers are running (httpd, Tomcat or something else), or whether they're on the same physical box or a different one. And the whole scheme will easily expand to using balancing with mod_proxy_balancer ... all of which are the subject of other resources you'll find here abouts!