tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Virtual Host and dynamic webapp reloading
Date Wed, 26 Sep 2007 16:31:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan,

Daniel M Garland wrote:
> I have three virtual hosts that I want to have hosting a webapp on
> the default path.

Different apps, or the same app on each virtual host?

> Each host has a few aliases for subdomains etc. So I don't really
> want to have ROOT.war in CATALINA_HOME/webapps, partly because I want
> to keep the manager app and partly because I would have a ROOT.war 
> files for each host.

You can deploy the manager app even when there is a ROOT application
deployed.

> so I think you're saying
> 
> CATALINA_HOME/webapps
>       /myapp1/ROOT
>       /myapp2/ROOT
>       /myapp3/ROOT

Well, I didn't say that, but if I had said something like that, I would
have suggested:

CATALINA_HOME/webapps (contains nothing)

VIRTUAL_HOME/www.domain1.com[/webapps]
                            ROOT
                            myapp1
                            myapp2
                            ...

VIRTUAL_HOME/www.domain2.com[/webapps]
                            ROOT
                            myapp1
                            myapp2
                            ...

You will need separate <Host> elements in your server.xml file. The
"appBase" for each of these should be VIRTUAL_HOST/www.[whatever].com,
or whatever you choose to be your directory layout.

If you are deploying all the same applications on all virtual hosts,
then you can ignore the whole virtual host concept and just use a
default host to serve everything regardless of the hostname.

> So I would've thought that I'd have the appBase of each host be 
> myappX/ROOT

No, no no. The "appBase" tells Tomcat where to look for deployable
applications, not the directory where /index.html should be found. This
is NOT the same thing as DocumentRoot in Apache httpd. Shave off the
ROOT and you've got yourself a decent configuration. If there is a
directory called ROOT (or a WAR file called ROOT.war) in the appBase
directory, /that/ application will be used as the one that is deployed
with no context path (i.e on / instead of /myapp).

> but what would the corresponding context.xml be?

The context.xml file should not contain any path information whatsoever.
All you need is JNDI resources, realm configuration and stuff like that.
This is a perfectly good context.xml file:

<Context />

You don't need anything else unless your application needs special
configuration. If you don't have anything in your context.xml file, you
can even leave it out, since Tomcat will give you the default deployment
configuration (which is an empty config).

> Does it actually work holding this file in /conf, I'm not sure about
> having this in the webapp, is it standard to have a
> META-INF/context.xml or is that a Tomcat thing?

This is a Tomcat thing only.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG+ol+9CaO5/Lv0PARAkpzAKCLVOu23XOa63lHvEMIvOOSe/DNSACfUa7m
U9DbG+9+gn2Q6mXVcI759Pc=
=b2Kr
-----END PGP SIGNATURE-----

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