> From: Dave Filchak [mailto:sub...@zuka.net]
> Subject: Re: Configuration help with tomcat connectors
> 
>     1a: I assume that if the DNS for a particular virtualhost (domain)
> points to this new IP, the tomcat server will serve the correct files
> based on the context?

True.

> 2. Modify the server.xml file to reference each virtualhost you want to
> serve i.e.
> 
> <Engine name="Catalina" defaultHost="virtualhost1">
>     <Host name="virtualhost1"    appBase="virtualhost1apps"/>
>     <Host name="virtualhost2"    appBase="virtualhost2apps"/>
> </Engine>

Virtual hosts are necessary if the URLs for the two domains would otherwise be 
in conflict (e.g., you want a separate default webapp for each domain.

> 3. Create directories for each of the virtual hosts in the tomcat
> directory i.e.:
> 
> mkdir $CATALINA_HOME/virtualhost1apps
> mkdir $CATALINA_HOME/virtualhost2apps

The appBase directories are not required to be under Tomcat's home directory, 
but it's perfectly o.k. to put them there if you want.

>     a: create a META-INF directory inside of the Context and place a
> context.xml in it i.e. $CATALINA_HOME/virtualhost1apps/META-
> INF/context.xml

The location is incorrect - it leaves out the context name.  Each <Host> can 
have multiple webapps deployed under it, with the only restriction being that 
the default webapp must be named ROOT (case sensitive).  So if you are 
referring to the default webapp for virtualhost1, the proper location would be:
$CATALINA_HOME/virtualhost1apps/ROOT/META-INF/context.xml

Note that if you have nothing interesting to put in the <Context> element for a 
given webapp, you don't need the context.xml file at all.

> Now, being as I am a tomcat rookie and just learning this stuff ... can
> you or someone explain the difference between docroot and approot?

I'll assume you mean docBase and appBase.  The appBase directory is the default 
location under which webapps for a given <Host> are deployed.  A docBase is the 
location (directory or .war file) of an individual webapp.  The docBase 
attribute of a <Context> element is only used when the webapp is deployed 
outside of the <Host> appBase directory; otherwise it is derived automatically 
just from the webapp's existence under appBase.

> Does one hold static html and the other jsp etc?

No; each webapp can consist of any combination of static and dynamic content.  
It's not uncommon for simple webapps to have no dynamic content, and be 
composed of just .html, .css, .jpg, etc.

> Where is docroot declared?

Assuming you mean docBase, it's usually not.  The docBase and path are derived 
from the location of the webapp under appBase.

Look at what comes in the standard Tomcat download: each of the directories 
under the <Host> appBase directory (webapps, by default) is a separate webapp.  
At least one (docs) is static content only, while most are a combination of 
static and dynamic.

 - 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 unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to