PDA

View Full Version : Tomcat Configuration



rfreedman
10-26-2008, 08:26 PM
I was having some problems setting up an application under Tomcat and getting it to be served out of the root context.

Unfortunately, Westhost tech support was no help - they told me that Tomcat could only be used to serve contexts below the root. Since I've had Tomcat serve the root context before (even though I've never set it myself), I knew it was possible.

A little "googling", a little trial-and-error, and all is now working.
For those trying to do the same, here's the solution:

1. Put your java web application (expanded .war file) in /var/tomcat5/ROOT

2. 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.

4. 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.

5. Go to your control panel and restart the server.

Everything should work as expected now. It did for me.
If you still have problems, post your question here, and I'll try to help if I can.

Corrado Fiore
10-29-2008, 04:28 AM
Hi Rfreedman,

thanks for sharing this valuable information -- much appreciated.

May I suggest WH site editors to add it to the online manual? ;-)

Cheers,
Corrado Fiore