tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Holloway" <wjhollo...@gmail.com>
Subject Re: Problem setting server.xml <host> <context> field.
Date Mon, 08 Jan 2007 20:25:09 GMT
I'm attempting a very similar setup and have been successful using the
info described here. Thanks for providing the detailed walk-through.

I have a follow up question, though. Is the use the name ROOT required
for the WAR or is there another way to specify the default context for
the Host? I ask because the our development environment uses only the
localhost Host and being able to copy WARs from the webapps dir of dev
server to the appBase of the prod environment without refactoring
would be really nice. I've tried editing the context after exploding
the war to the empty path attribute but this doesn't work. Oddly
enough, this does work if the context info is copied from the
context.xml file and pasted into server.xml (followed by a restart of
tomcat).

ie this works:

  <Host name="zorp.org" appBase="/vhosts/zorp" autoDeploy="false">
      	
      	<Context path="" docBase=""  reloadable="true">
	</Context>
      </Host>

where as this does not
 <Host name="zorp.org" appBase="/vhosts/zorp" autoDeploy="false">
 </Host>

 and $CATALINA_HOME/conf/Catalina/zorp.org/zorp.xml is

	<Context path="" docBase=""  reloadable="true">
	</Context>

Many thanks,
bill

On 1/3/07, Caldarale, Charles R <Chuck.Caldarale@unisys.com> wrote:
> > From: Jacob Rhoden [mailto:jacob@rhoden.id.au]
> > Subject: Re: Problem setting server.xml <host> <context> field.
>
> > I would like to use virtual hosts so that:
> > mainserver.com:8080/Application1/index.jsp maps to fish.com/index.jsp
> > mainserver.com:8080/Application2/index.jsp maps to
> apples.com/index.jsp
>
> 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:
> http://tomcat.apache.org/tomcat-5.5-doc/config/host.html
> http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
>
> You should have two <Host> elements with name attributes "fish.com" and
> "apples.com" 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
> webapps.fish.com and webapps.apples.com (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
> webapps.fish.com/ROOT/index.jsp and webapps.apples.com/ROOT/index.jsp
> 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 webapps.fish.com/ROOT/META-INF/context.xml and
> webapps.apples.com/ROOT/META-INF/context.xml).  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/fish.com and conf/Catalina/apples.com.  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
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> 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: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message