On Fri, 2005-09-16 at 19:31 -0700, Mark Eggers wrote:
> 
> --- Michael Sullivan <[EMAIL PROTECTED]> wrote:
> 
> > OK.  For clarification I am running
> > tomcat-5.0.27-r6.  I want user's
> > tomcat files to be read from
> > /home/*/webspace/webapps.  My personal
> > account is michael so my personal tomcat directory 
> > would
> > be /home/michael/webspace/webapps .  Just for the
> > sake of arguments I
> > created a directory called user under
> > /home/michael/webspace/webapps and
> > moved my jsp files into it.
> > My /opt/tomcat5/conf/Catalina/localhost/user.xml
> > file looks like this
> > now:
> > 
> > <Context
> > docBase="/home/michael/webspace/webapps/user"
> >         debug="0" privileged="true">
> > </Context>
> 
> You don't need privledged="true", so let's remove
> that.
> 
> > I restarted Tomcat.  I am using mod_jk and when I go
> > to
> > www.espersunited.com/index.jsp I see the Tomcat
> > start page.  However,
> 
> Good, you're using mod_jk.  You will need to do some
> Apache configuration in order for this to work.
> 
> I am going to assume that /home/* lies outside of the
> DocumentRoot directory tree.
> 
> 1. Get Apache to recognize web directories outside of
> the DocumentRoot tree.  There are several ways of
> doing this.  One such way is given in the actuall
> httpd.conf file that comes with the stock Apache.
> 
> Basically you need to give a set of Directory
> directives that give Apache access to the material in
> the home directories.
> 
> If you use the userdir_module in Apache, then
> ~username/<directory> will become a part of the web
> space (if you take the comments out).
> 
> If you do this by hand, you'll need to give both
> Directory directives and an Alias directive to move it
> into the web space that Apache serves.
> 
> 2. Once you do that, you'll need to add JkMount
> statements as well.  I suspect that JkMount statements
> will respond to Alias directives since JkMount deals
> with web space and not directories.
> 
> I don't know if JkMount interacts with the
> userdir_module.  In other words, I don't know what
> will happen if you put in a JkMount statment that
> reads:
> 
> JkMount /~*/*.jsp tomcat
> 
> It would be interesting to find out if that would end
> up mapping to /~<username>/<directory>/*.jsp where
> <username> is the user name and <directory> is the
> value of UserDir.
> 
> 3. Once you do that, it's always nice to make a small
> WEB-INF/web.xml, even for plain jsp pages.  Something
> like the following should work:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC
> "-//Sun Microsystems, Inc.//DTD Web Application
> 2.3//EN"
>  "http://java.sun.com/dtd/web-app_2_3.dtd";>
> <web-app>
> <display-name>Beginning JSP</display-name>
> <description>Container for quick
> jsptests</description>
> <welcome-file-list>
>   <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> </webapp>
> 
> Sorry for the wrapping.
> 
> In short, you need to do the following three steps.
> 
> 1. Make sure your Apache server knows about
> directories outside of DocumentRoot.  Use Directory
> and Alias directives or userdir_module.
> 
> 2. Use JkMount to map the expected incoming URLs to
> the Tomcat server.  Experiment to see if JkMount picks
> up on the substitutions done by userdir_module.
> 
> 3. Make a small WEB-INF/web.xml with the appropriate
> structure.  Creating a proper web application is
> useful, especially once you start adding servlets to
> the mix.
> 
> /mde/
> 


I've been wrestling the past week with the hassles of upgrading to
Apache-2.0.54-r31 on my Gentoo system.  I think I've finally got
everything working the way it's supposed to except mod_jk for my user
directories.  I tried to do the userdir thing you suggested, but I
couldn't get it to work.  Right now I use symlinks to my individual
users' website directories, but now that I've discovered Alias I'll
probably switch completely to using Aliases.  I created a test Alias
point to the ~/webspace/webapps directory in my personal account, but I
can't seem to JkMount it, and I can't figure out why.  Here is the
mod_jk portion of my httpd.conf file:

#mod_jk stuff

LoadModule jk_module                     modules/mod_jk.so

JkMount /*.jsp wrkr
JkMount /servlet/* wrkr
# Deny direct access to WEB-INF
<LocationMatch ".*WEB-INF.*">
   AllowOverride None
   deny from all
</LocationMatch>
Alias /michael /home/michael/webspace/webapps
<Directory /home/michael/webspace/webapps>
    Options FollowSymLinks
    AllowOverride None
</Directory>

I don't know if I need that <LocationMatch> stuff - It was part of a
<VirtualHost> block that seemed to be unecessary, so I took it out.  I
tried putting my JkMount statements inside the <Directory> block, but
when I tried to restart Apache it gave me the following error:

JkMount can not have a path when defined in a location

In /home/michael/webspace/webapps there is a file called colors.jsp.
When I navigate my browser to www.espersunited.com/michael/colors.jsp I
get the Tomcat 404 error, yet when I navigate to
www.espersunited.com/index.jsp I get the Tomcat start page.  What am I
doing wrong?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to