You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Garrett <mi...@inixoma.com> on 2003/08/25 09:10:05 UTC

of vhosts and workers

I'm in the process of configuration Tomcat 4.1.27 to communicate with Apache
1.3.28 through mod_jk on a single machine. I have several virtual hosts set up
on my server in the following way: /home/vhost1, /home/vhost2, etc.. I would
like to configure Apache/Tomcat to allow users of these vhosts to serve
JSPs/Servlets from beneath their home directories, e.g.:
/home/vhost1/public_html/webapps/ and /home/vhost2/public_html/webapps/. From my
reading, I understand that this can be accomplished by:
- setting the appBase attribute of the <Home> tag in the server.xml to those
absolute directories:
    <Home appBase="/home/vhost1/public_html/webapps/"...>
    ...
    <Home appBase="/home/vhost2/public_html/webapps/"...>
- setting the docBase/path attributes in the child <Context> tag to some
directory within the appBase path:
    <Home appBase="/home/vhost1/public_html/webapps/"...>
        <Context docBase="app1" path="/app1"...>
    ...
    <Home appBase="/home/vhost2/public_html/webapps/"...>
        <Context docBase="app1" path="/app1"...>
This would cause the primarly application "app1" to be served out of vhost1's
home from /home/vhost1/public_html/webapps/app1, and another applicationed
"app1" belonging to vhost2 to be served out of
/home/vhost2/public_html/webapps/app1. This is my understanding of these
attributes, though I don't quite get what the distinction between docBase and
path is, as I've not found a decent enough description nor a solid example to
set these in stone for me.

My questions:
1: Would the aforementioned configuration properly serve JSPs/Servlets from
locations beneath vhost1 and vhost2's home directories?
2: What exactly do the docBase and path attributes define within the Context
tag? What is the distinction?
3: It is possible to have a single worker handle requests for more than one web
application belonging to more than one virtual host/user. How beneficial would
it be to have a single worker handle requests sent to it from Apache for more
than one virtual host? Would it be more efficient to have one worker for each
virtual host and have a load balancing worker to manage those subordinate
workers?
4: What sort of mechanisms to workers use to handle requests? Does a worker
receive a request, fork(), child process handles the request, communicates with
the Tomcat JVM, and returns the result to the requesting client, while the
parent simply sits and listens for more connections? If this is the case, would
a load balancer really serve to benefit anything if all this is taking place on
a single machine, given that all the workers would be of type ajp13?

I'm trying to achieve and optimal, secure configuration. One that would allow
the users to manage their own web applications within their home directories so
I don't have to open up rwx access to the world beneath the $TOMCAT_HOME
directory. Granted, I'll still have to amend server.xml to insert new contexts
for users adding new WARs, but this is trivial. I've read a number of articles
and even the manual describing configuration options, etc., but it seems that
there are just a few points missing that would really put things into
perspective for me, so I'm sending these, probably simple, questions to the
list, as my last resort. Any information or links would be greatly appreciated,
and hopefully I'll be able to get everything organized efficiently and securely.

Thanks,
Christopher Garrett III
Inixoma, Incorporated