Apache / Tomcat Integration - Serving The Root Context
About a year ago, I set up a web hosting reseller account with WestHost (http://westhost.com). I’ve been pretty happy with them (this site is hosted there), but up until now, I haven’t pushed the limits much.
Today, I tried to set up a new virtual site with Tomcat serving the root context. I’ve never tried to configure this before, but have become accustomed to either deploying my root application either as webapps/ROOT.war or deploying my expanded app in webapps/ROOT
I did this, and it didn’t work. I did an on-line chat with WestHost tech support, and the nice person at the other end of the chat informed me that what I wanted to do was not possible. I thought about it for a moment, and decided that I’d be better off solving this on my own.
After a little “googling”, and some minor trial-and-error, I came up with a 4-step solution: 1. Put your java web application (expanded .war file) in /var/tomcat5/ROOT
- Edit /etc/httpd/conf.d/jk.conf, and add the following: #Root mounts JkMount /* ajp13w JkMount /servlet/* ajp13w
3.Edit /etc/http/conf/httpd.conf: find the line that begins with DirectoryIndex It lists all of the allowable “start page” names. Add index.jsp to the front of the list.
-
Go to /var/www/html and rename index.html to something else, like index.html.orig This is so that this index.html doesn’t override index.jsp in your app, if you’re using that.
-
Go to your control panel and restart the server.