difference is that I use one installation of Tomcat for all the sites.
I have a script to start tomcat for each site, that points CATALINA_HOME to the
shared Tomcat binaries, and CATALINA_BASE to the conf/, logs/, temp/, work/, and
webapps/ directories for the site:
file /home/site1/tomcat/catalina: #!/bin/sh CATALINA_BASE = "/home/site1/tomcat" CATALINA_HOME = "/usr/share/tomcat4" (or whatever) CATALINA_OPTS = "-server" (maybe others) export CATALINA_BASE CATALINA_HOME CATALINA_OPTS $CATALINA_BASE/bin/catalina.sh $*
I can do ./catalina start, ./catalina stop, etc to control each site. It works pretty well, especially if you're developing one site while others are in production.
Two things to watch for:
1) You are correct that you have to use different ports for each server.xml file.
I declared that site one could have ports between 8100-8199, site 2 between 8200-8299,
etc. Each project can use whatever they want in their range.
2) Since these Tomcat instances listen on ports above 1024, they don't need to
be started by the "root" user. If they did, I'd be very wary of putting the
server.xml file (and other config files and scripts) where the user could
modify them. Also, your system boot procedures need to take some steps to
start them using the correct username.
3) I use Apache as a front end for all these Tomcat instances, using a proxy instead of JK or JK2. In each virtual host, there's something like this: ProxyPass /examples/ http://localhost:8181/examples/ ProxyPassReverse /examples/ http://localhost:8181/examples/ There are two nice things about this: Apache logs everything, making it easier to do usage reports. And, all the connections to Tomcat come from Apache and localhost, so I can block outside connections to all ports except the ones Apache listens to. However, it's still possible for user A to change his server.xml file to listen to a port that's being sent traffic for user B. For my purposes, that's not an issue; for others, it may be.
Good luck! ...Bob Langford...
At 02:12 PM 9/6/2003, you wrote:
Hi,
I have Apache 1.3 and Tomcat 4.1.8 on a Red Hat 9 machine.
Apache serves several virutal hosts. We have one Tomcat instance running with several web contexts, one context for each virtual host.
Now I would like to change this to have one Tomcat instance for each virtual host (this is necessary because Tomcat sometimes crashes, and I don't want all virtual hosts to be down then).
I read a book about Tomcat and searched the Web, but could not find out how to do this. What I assume is:
In Apache's httpd.conf I have something (after the import of mod_jk):
NameVirtualHost 200.200.200.200 (or whatever)
<VirtualHost 200.200.200.200> ServerName www.xxx.com DocumentRoot /tomcat1/webapps/xxx JkMount /servlet/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 </VirtualHost>
<VirtualHost 200.200.200.200> ServerName www.yyy.com DocumentRoot /tomcat2/webapps/yyy JkMount /servlet/* worker2 JkMount /*.jsp worker2 JkMount /*.do worker2 </VirtualHost>
Then I will install Tomcat two times, in /tomcat1 and /tomcat2.
The server.xml of each Tomcat contains different ports (for shutdown and for the connector for ajp13).
The workers.properties should look like:
worker.list=worker1,worker2 ... worker.worker1.port=8009 worker.worker1.host=localhost worker.worker1.type=ajp13 ... worker.worker1.port=8010 worker.worker1.host=localhost worker.worker1.type=ajp13
Is this all correct? Should that work?
Thomas
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Bob Langford
Silicon Masters Consulting, Inc. 8207 Stone River Court, Richmond, VA 23235
phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]