Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Two Tomcats and One Apache Web Server

Martin Kuba

2003-12-09

Replies:

Walter do Valle wrote:
> Hello all
>
> Is it possible to install two Tomcats in the same linux server, put some web applications in one tomcat, put some web applications in other tomcat and both tomcats answer to the same Apache Web Server?
> Anyone has made this?
> Is there any tips and tricks about this matter?
> What is the best way to do this (if possible)?

Sure. Set the TomCats to listen for AJP13 requests on
two different ports, say 8009 and 8010 by changing the
port number in their conf/server.xml.
In the first tomcat, leave this section as it is:

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
          port="8009" minProcessors="5" maxProcessors="75"
          enableLookups="true" redirectPort="8443"
          acceptCount="10" debug="0" connectionTimeout="0"
          useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

and in the second tomcat, change 8009 to 8010.

Then install mod_jk into Apache and define two workers in
workers.properties:

worker.list=t1,t2
worker.t1.type=ajp13
worker.t1.port=8009
worker.t1.host=localhost
worker.t2.type=ajp13
worker.t2.port=8010
worker.t2.host=localhost

then map them in httpd.conf:

LoadModule    jk_module          libexec/mod_jk.so
JkWorkersFile "/etc/httpd/workers.properties"
JkLogFile "/var/log/httpd/mod_jk.log"
JkLogLevel info
JkMount /webapp1/* t1
JkMount /webapp2/* t2

It will route requests for /webapp1 to the first tomcat
and requests for /webapp2 to the second tomcat.

Martin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno         Martin Kuba
Institute of Computer Science   email: makub@(protected)
Masaryk University         http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ   mobil: +420-603-533775
--------------------------------------------------------------

Attachment: smime.p7s
©2008 junlu.com - Jax Systems, LLC, U.S.A.