Fresh Blurbs

Proxying to Tomcat from Apache

J2EE servers (Tomcat, JBoss, you name it) usually run on a port that is higher than 1000. Otherwise they would have to be run as root, which would be a serious security hole. Apache, on the other hand is a time-proven web-server that runs on port 80. Following are quick instructions for how to proxy your J2EE application server from Apache so that your J2EE applications show up on nice URLs without a port number in them.

Make sure mod_proxy is available and enabled in Apache. Create a VirtualHost, in Apache, as you normally would, but instead of indicating a DocumentRoot put following lines:\

ProxyRequests Off
ProxyPreserveHost  On
ProxyPass /yourpath http://localhost:8080/appctxt
ProxyPassReverse /yourpath http://localhost:8080/appctxt

That's it.

You can also channel Apache to a Java app server using AJP connectors and Apache's mod_jk module. It give you more powerful options like: load-balancing, but also involves more configuration both on Apache and Tomcat/JBoss side.

Of course, using mod_proxy you can tunnel not just J2EE servers, but any other server even the one you might have written in C++ for fun.

Enjoy

comments powered by Disqus