You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Noel J. Bergman" <no...@devtech.com> on 2001/12/17 22:17:40 UTC

PLEASE HELP: Apache+Tomcat - Virtual hosts + separate VMs

I am STILL trying to find out how to configure Apache+Tomcat so that EACH
virtual host has ITS OWN JVM.  This seems to be a fairly common question,
but no one seems willing to actually answer it.

Ideally we want some means that works well with the perchild module, so that
not only is each virtual host assigned its own privileges under Apache, but
each JVM is also restricted to the privileges available to that uid.

Thanks!  :-)

	--- Noel


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: PLEASE HELP: Apache+Tomcat - Virtual hosts + separate VMs

Posted by James Chuang <dr...@earthlink.net>.
Noel:

Let me give this one a shot.  I just did this for Tomcat 3.24 over the
weekend.

To each have a separate JVM, you basically need multiple Tomcat sessions.
Which means, you need multiple server.xml, each with it's own context
definition serving a particular JVM.

So, here is what you need to do:

Configure Apache to support each virtual host.  In my case, I used the
NameVirtualHost settings, and for each virtual host, I had a different
document root.

Create a mod_jk.conf that supports directing traffic to different VHOSTS
based on some sort of path.  This is the important parts:

Alias /host1 "/opt/host1"
<Directory "/opt/host1">
    Options FollowSymLinks
</Directory>
JkMount /host1/servlet/* ajp13
JkMount /host1/*.jsp ajp13

Alias /host2 "/opt/host2"
<Directory "/opt/host2">
    Options FollowSymLinks
</Directory>
JkMount /host2/servlet/* ajp13_2
JkMount /host2/*.jsp ajp13_2

Notice that the ajp workers are labeled differently.

Now, modify workers.properties to support the new workers...  There are 2
new workers, one to support the admin functionality of each tomcat server,
and one to support the connection to Apache
>>>
worker.list=ajp12, ajp12_2, ajp13, ajp13_2

worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
worker.ajp12_2.port=8010
worker.ajp12_2.host=localhost
worker.ajp12_2.type=ajp12
worker.ajp12_2.lbfactor=1

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.ajp13_2.port=8011
worker.ajp13_2.host=localhost
worker.ajp13_2.type=ajp13
worker.ajp13_2.lbfactor=1

Now, make copies of server.xml, one that is server1.xml, and one is
server2.xml.  Server 1 would have context stuff looking like this:

        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"
       value="org.apache.tomcat.service.connector.Ajp12ConnectionHandler"/>
            <Parameter name="port" value="8007"/>
        </Connector>

        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
          <Parameter name="handler"

value="org.apache.tomcat.service.connector.Ajp13ConnectionHandler"/>
          <Parameter name="port" value="8009"/>
        </Connector>

        <Context path="/vhost1"
                 docBase="/opt/vhost1"
                 crossContext="false"
                 debug="0"
                 reloadable="true" >
        </Context>

And server2.xml would have the ports modified appropriately, and with the
right context definition.

Now, start tomcat by doing this:

startup.sh -f  $TOMCAT_HOME/conf/server1.xml

You need to specify the -f parameter for shutdown as well.

If all this is done right, you now have 2 tomcat's running, each with it's
own JVM, each with it's own context and vhost support.

Good luck!

jchuang






----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: <to...@jakarta.apache.org>
Sent: Monday, December 17, 2001 1:17 PM
Subject: PLEASE HELP: Apache+Tomcat - Virtual hosts + separate VMs


> I am STILL trying to find out how to configure Apache+Tomcat so that EACH
> virtual host has ITS OWN JVM.  This seems to be a fairly common question,
> but no one seems willing to actually answer it.
>
> Ideally we want some means that works well with the perchild module, so
that
> not only is each virtual host assigned its own privileges under Apache,
but
> each JVM is also restricted to the privileges available to that uid.
>
> Thanks!  :-)
>
> --- Noel
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


----- Original Message -----
From: "Noel J. Bergman" <no...@devtech.com>
To: <to...@jakarta.apache.org>
Sent: Monday, December 17, 2001 1:17 PM
Subject: PLEASE HELP: Apache+Tomcat - Virtual hosts + separate VMs


> I am STILL trying to find out how to configure Apache+Tomcat so that EACH
> virtual host has ITS OWN JVM.  This seems to be a fairly common question,
> but no one seems willing to actually answer it.
>
> Ideally we want some means that works well with the perchild module, so
that
> not only is each virtual host assigned its own privileges under Apache,
but
> each JVM is also restricted to the privileges available to that uid.
>
> Thanks!  :-)
>
> --- Noel
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>