Connect Apache to Tomcat Using mod_jk


This short tutorial will explain how to connect Apache 2 to Tomcat 10 using mod_jk.

First thing, let’s install mod_jk.

sudo apt install libapache2-mod-jk

Now let’s create the workers properties file:

sudo vi /etc/apache2/

Here is a simple example:

#Define 1 real worker using ajp13
# Set properties for worker (ajp13)

Next, edit Tomcat’s server.xml file to enable the AJP connector (instead of uncommenting the existing line, for testing you can use this line):

<Connector protocol="AJP/1.3" address="" secretRequired="false" port="8009" redirectPort="8443" />

Update your Virtual Host(s) to use the worker to process the files (you may filter which files go through Tomcat):

<VirtualHost *:80>
JkMount /*.jsp ajp13

Restart Tomcat and Apache

sudo systemctl restart tomcat
sudo systemctl restart apache2

Leave a Reply

Your email address will not be published. Required fields are marked *