tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Problem setting server.xml <host> <context> field.
Date Thu, 04 Jan 2007 04:32:33 GMT
> From: Jacob Rhoden [] 
> Subject: Re: Problem setting server.xml <host> <context> field.

> I would like to use virtual hosts so that:
> maps to
> maps to

The preliminary question is: do you really need to use httpd or other
front end to Tomcat at all?  Response will generally be faster without
something else up front adding path length.  If you do need to front end
Tomcat, someone else will have to help you with that config, since I
have very, very limited experience with mod_jk.

Proceeding with a stand-alone config, the first step is to read the
docs, if you haven't already done so:

You should have two <Host> elements with name attributes "" and
"" respectively in server.xml, inside the <Engine> element.
One of your <Host> names must be declared to be the default one in your
<Engine> element, since some requests may come in via IP address rather
than a name.  (You could always define a third one - such as the
existing localhost - for that purpose.)  You only need one <Connector>
inside your <Engine>; it will handle requests for all <Host>s.  If you
get rid of the front end and mod_jk, just use the HTTP version and set
the port number to 80.

The two (or three) <Host> elements should use unique appBase settings to
avoid overlapping deployments; for example, you could use and (leaving the plain webapps for
the third default <Host> if you go that way).  The default app for each
<Host> should be deployed under its appBase directory in the ROOT
subdirectory (or as ROOT.war) - note that this name is case sensitive.
So, your index.jsp files would be located in and
for Application1 and Application2, respectively, along with the rest of
the components of each app.

You likely do not need <Context> elements for your apps, since Tomcat
uses the name of the deployment directory to derive the URL path for the
app, with ROOT being the required alias for the default app (what used
to be specified with an empty string path attribute).  If you really
have to use <Context> elements, they should be placed in context.xml
files in each app's META-INF directory (in the ongoing example, that
would be and  Such <Context> elements
must not contain path or docBase attributes.

You can also choose to deploy your apps outside of the <Host> appBase
directories.  If you wish to do so, you will need ROOT.xml files in
conf/Catalina/ and conf/Catalina/  Each of these
ROOT.xml files must contain a single <Context> element with a docBase
attribute pointing to the location of each <Host>'s respective default
app.  Again, the path attribute must not be used.

 - Chuck

MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message