Skip to content
IT // Adventures

Configuring the Apache Tomcat Connector 'mod_jk'

Configuring Apache Httpd as a reverse proxy for Tomcat with 'mod_jk'.

1 min read

With the “mod_jk” module, an Apache web server can act as a “reverse proxy”: it accepts requests and forwards them to a Tomcat service. Among other things, this makes it possible to publish applications on “internal” Tomcat servers through a public Apache web server.

Loading the Tomcat Connector Module in Apache Httpd

For clarity, the configuration directives for the Tomcat module are moved to the file /extra/httpd-tomcat.conf.

LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
    Include conf/extra/httpd-tomcat.conf
</IfModule>

Configuration File for the Tomcat Connector

Create the configuration file “httpd-tomcat.conf” for Tomcat with the following content:

JkWorkersFile "conf/workers.properties"
# Where to put jk shared memory
JkShmFile "D:/Apache/logs/mod_jk/mod_jk.shm"
# Where to put jk logs
JkLogFile "D:/Apache/logs/mod_jk/mod_jk.log"
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

Tomcat worker.properties

Create the configuration file “worker.properties” for the Tomcat worker:

# Tomcat Worker #0 - Mod_JK Status Handler
worker.list=jkstatus
worker.jkstatus.type=status
# Tomcat Worker #1 - Management Interface
worker.list=workerMgmt
worker.workerMgmt.type=ajp13
worker.workerMgmt.host=localhost
worker.workerMgmt.port=8009