tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Berthold" <CBerth...@terrafirma-productions.com>
Subject RE: Apache + Tomcat configuration: static / dynamic content (with ROOT application deployed)
Date Thu, 31 Aug 2006 16:27:28 GMT
Place the static content in Apache in the directories that would be
referenced by Tomcat.  The way you did it will work but it is not
recommended especially if you would like to deploy WAR files quickly and
the static content does not change often.  You can deploy the files to a
different document root in apache and this solution will still work.
You were close in what you needed to do.  You are only missing a few
entries

JkUnmount /images/
JkUnmount /webappA/images/
JkUnmount /webappB/images/

Jkmount will include an entire tree.
Jkunmount excludes parts of the directory tree.

-----Original Message-----
From: Hua Hou [mailto:hua@handango.com] 
Sent: Wednesday, August 30, 2006 10:11 AM
To: tomcat-user@jakarta.apache.org; users@tomcat.apache.org
Subject: Apache + Tomcat configuration: static / dynamic content (with
ROOT application deployed)

I think this question had been asked before. But when I searched the
tomcat user group, I don't find a satisfactory answer.

 

Here is my question: How to configure Apache & Tomcat so that Apache
handles static content for virtual host with more than one web
applications?

My web application directories are as following:

/webapps/

/webapps/webappA/

/webapps/webappB/

/webapps/ROOT/

 

I have three web applications (contexts): the default(""),
webappA("/webappA"), and webappB("/webappB"). Each application has both
static content and dynamic content (JSP/servlet).

 

in Apache httpd.conf, I have the following virtual host definition:

 

NameVirtualHost *:80

<VirtualHost *:80>

            ServerName www.myserver.com

            DocumentRoot "F:/Tomcat5.5/webapps"

    JkMount  /servlet/* worker1

    JkMount  /*.jsp worker1

</VirtualHost>

 

With this configuration, everything works, except that the static
content for the default application (/ROOT) can't be loaded by Apache
because Apache can't find the content.

 

If I change the DocumentRoot to:

            DocumentRoot "F:/Tomcat5.5/webapps/ROOT"

 

The static content for the default application can be loaded by Apache,
but the static content for the other two web apps can't be loaded
(outside of DocumentRoot).

 

How can I configure virtual host so that the above problem can be
solved?

 

I did figure out a workaround, here it is:

 

NameVirtualHost *:80

<VirtualHost *:80>

            ServerName www.myserver.com

            DocumentRoot "F:/Tomcat5.5/webapps/ROOT"

            Alias /webappA/ F:/Tomcat5.5/webapps/webappA

            Alias /webappB/ F:/Tomcat5.5/webapps/webappB            

    JkMount  /servlet/* worker1

    JkMount  /*.jsp worker1

</VirtualHost>

 

With the above configuration, all static / dynamic content for all the
three web apps can be loaded properly. However, is this a standard /
recommended configuration?

 

Your help will be greatly appreciated!

 

Best Regard,

 

Hua Hou

 


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