views:

68

answers:

1

Hi,

I have an apache instance fronting 4 tomcat webapps, lets call them app1, app2, app3, app4. I'm using mod_jk to act as the connector and I've set up apache with JKMount entries for each and I can happily hit:

server:8080/app1

server:8080/app2

server:8080/app3

server:8080/app4

But what i actually want is to have all the traffic for app1, app2 and app3 be addressed as above, but with app4 (only) addressed on:

server:8080/

I was sure this was going to be easy, but i can't figure it out. Any ideas?

Gordon

+2  A: 

If I understand correctly, you want to set app4 as the default web app - so that it will be available directly as server:8080/

all you need to do is you can set the path as "" in a Context element within <Host> in server.xml on Tomcat. . This should work

<Context docBase="/var/lib/tomcat6/webapps/app4/" path="" reloadable="true>

From the Tomcat docs,

If you specify a context path of an empty string (""), you are defining the default web application for this Host, which will process all requests not assigned to other Contexts

Ensure you restart Apache and Tomcat once to enable the changes.

Note: From the Tomcat 6 docs http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Introduction it is recommended not to put this in server.xml since you need to restart Tomcat for any changes.

The default web application may be defined by using a file called ROOT.xml

but i have not tried that option myself.

JoseK