Saturday, March 01, 2008

Go Daddy: Configure Apache HTTPd as a reverse proxy for Tomcat

Configuring Apache HTTPd as reverse proxy is one way to re-route requests to Tomcat from Apache. This post addresses how to do that for Dedicated Virtual Hosting at GoDaddy.com. Doing this requires simple configuration changes as described below:

1. Find httpd.conf file (usually located at /etc/httpd/conf).
2. Make sure the following lines are not commented in the file (by default they are not commented).
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
3. Add the following lines to enable the proxy to http.conf assuming you want to enable the servlet-examples webapps that comes with Tomcat installation (better to add at the end of the file):
ProxyPass /servlets-examples http://localhost:9080/servlets-examples
ProxyPassreverse / http://localhost:9080/
4. Restart Apache (using /usr/sbin/apachectl).

Now type http://www.yoururl.com/servlets-examples/ in your browser and you will be able to execute the Servlet samples.