Connecting Apache and Tomcat through mod_jk

Mod JK is the Apache Tomcat Connector.   Allows one to serve Tomcat webapps from Apache Http server.

Steps to install.
Note: This is based off my machines setup Apache 2.2.14, Tomcat 6, Windows 7 64 Bit, Mod JK 1.2.28

1. Download Apache webserver, Install it and verify it is running see “http://httpd.apache.org/” for more information.

2. Download Tomcat, Install it and verify it is running. See “http://tomcat.apache.org/” for more information

3. Download the Apache Tomcat Connector and copy it to [APACHE_ROOT]/modules. See http://tomcat.apache.org/connectors-doc for more information.

I was able to download the MOD_JK here http://apache.multihomed.net/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/

4. Create a “workers.properties” file and place it at [TOMCAT_ROOT]/conf/jk

AJP13 worker is the preferred worker type that JK uses for communication between web server and Tomcat. Here is a simple implementation of the workers.properties file

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

5. Edit the Apache Configuration file [APACHE_ROOT]/conf/httpd.conf in the following way

LoadModule jk_module /modules/mod_jk-1.2.28-httpd-2.2.3.so
Include "[PATH_TO_TOMCAT]/conf/auto/mod_jk.conf"

6. Edit Server.xml in [TOMCAT_ROOT]/conf in the following manner.

Under the <Server> node add this

<Listener className = "org.apache.jk.config.ApacheConfig" 
workersConfig="conf/workers.properties" 
mod_Jk="[PATH_TO_APACHE]/modules/mod_jk.so" 
jkLog="logs/mod_jk.log" jkDebug="info" noRoot="false"/>

Under the <Engine> node add this

Restart Tomcat.. You should see a new file [TOMCAT_ROOT]/conf/auto/mod_jk.conf

Restart Apache.. you should be good