tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: How to setup mod_jk to work with an Instance of CATALINA_BASE
Date Tue, 23 Dec 2014 10:09:24 GMT
Nikolas Nikolaou wrote:
>  Hi. I've managed to connect the default  CATALINA_HOME  tomcat 8.0.15 with apache2 using
mod_jk but I can't find Info on how to connect to an Instance of CATALINA_BASE. What changes
would I need to make to the workers file as to the location of tomcat_home.

You may be looking at this from the wrong side, and that may be why you are getting confused.

mod_jk is a connector, which allows to "connect" *one* front-end instance of Apache httpd,

with *one or multiple* back-end tomcat instances (which in mod_jk terminology, are called

If one Apache2 front-end connects to multiple back-end Tomcat instances, then mod_jk can 
act not only as a connector, but it can also act :
- as a switch, by forwarding requests to different Tomcats based on the request URLs
- as a load-balancer, by forwarding requests to different Tomcats based on some 
load-balancing algorithm
- or as both

Schematically :

Browser <-- HTTP --> Apache2 + mod_jk <-- AJP --> Tomcat1 + webapps
                                   |--<-- AJP --> Tomcat2 + webapps
                                   |--<-- AJP --> Tomcat3 + webapps
each of the above Tomcat's, would be known to mod_jk as a "worker", e.g.
Tomcat1 = worker1
Tomcat2 = worker2
Tomcat3 = worker3

mod_jk "talks to" a specific Tomcat worker using TCP/IP.
For that, mod_jk needs to know the IP address/port of that Tomcat worker, on which it is 
listening for such requests (a).
Vice-versa, to accept requests from mod_jk and respond to them, each Tomcat instance needs

an "AJP Connector", set up to listen on a specific IP address/port combination (b).

(a) is configured in the Apache2/mod_jk "" file, which is unique and 
belongs to the unique mod_jk module in Apache2.
The syntax of the file is explained here :
In this file, there should be one "worker" defined, for each back-end Tomcat instance you

wish to communicate with.

(b) is configured in each of the running Tomcat instances specifically, by a configuration

snippet like <Connector protocol="AJP.."
The syntax of this is explained here :

To allow mod_jk to communicate with a given running Tomcat instance, there must be a match

- the IP (or DNS name) and port that you indicate for a "worker-x" (a running Tomcat 
instance) in the (single) Apache2 file
- and the "listening IP/port" that you indicate in the AJP <Connector> entry in the

configuration of that Tomcat instance (in the "server.xml" configuration file that is in 
that Tomcat's CATALINA_BASE directory.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message