You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/02/26 23:25:43 UTC
apache 2, tomcat 5, and ROOT application
Tomcat 5 uses ROOT for the root application,
and whatever for other applications. For
example, I am keeping my content in its
own hierarchy:
/home/tomcat/mywebsite/webapps/ROOT
/home/tomcat/mywebsite/webapps/myapp
I want apache to handle static content
and tomcat to handle servlet related
stuff (jsp, etc). I am wondering how
to specify that in httpd.conf. If I set
DocumentRoot to /home/mywebsite/webapps/ROOT/
that will work for http://mywebsite.com/ but
it will not find myapp. If I set it to
/home/mywebsite/webapps/ it can find
http://mywebsite.com/myapp, but then I don't
know how it can find the ROOT directory.
Here's an httpd.conf snippet:
#======
<VirtualHost *:80>
ServerAdmin webmaster@mywebsite.com
ServerName www.mywebsite.com
ServerAlias mywebsite.com
DocumentRoot /home/tomcat/mywebsite.com/webapps/ROOT/
ErrorLog /home/tomcat/mywebsite.com/logs/error_log
CustomLog /home/tomcat/mywebsite.com/logs/access_log common
# Deny direct access to WEB-INF and META-INF
#
<Location "/WEB-INF">
AllowOverride None
deny from all
</Location>
# <Location "/META-INF">
AllowOverride None
deny from all
</Location>
JkMount /*.jsp mywebsite
</VirtualHost>
#=====
Any ideas?
Dean Hoover
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: apache 2, tomcat 5, and ROOT application
Posted by Christopher Schultz <ch...@comcast.net>.
Dean,
> I want apache to handle static content
> and tomcat to handle servlet related
> stuff (jsp, etc). I am wondering how
> to specify that in httpd.conf. If I set
> DocumentRoot to /home/mywebsite/webapps/ROOT/
> that will work for http://mywebsite.com/ but
> it will not find myapp. If I set it to
> /home/mywebsite/webapps/ it can find
> http://mywebsite.com/myapp, but then I don't
> know how it can find the ROOT directory.
Here's what you want. For each webapp, you need JkMounts and Aliases.
You can use VirtualHosts if you have different server names, but this
works, too.
# Here's the root stuff
DocumentRoot /path/to/webapps/ROOT
JkMount /*.jsp root-worker
JkMount /whatever root-worker
# Here's the stuff for 'app1'
Alias /app1 /path/to/webapps/app1
JkMount /app1/*.jsp app1-worker
JkMount /app1/whatever app1-worder
You can do this for each of your applications. Just alias the base URL
to the webapp's directory and add JkMounts.
-chris