Integrating Apache and Tomat with mod_jk

This post is a continuation of my previous post. In this post I’ll tell you what I did to access my tomcat apps via Apache.

All the files you edit here are very crucial. Take a backup and make a note of the changes you do. Otherwise, it may goof your Apache configuration.

Installing mon-jk library

$ sudo apt-get install libapache2-mod-jk

Make sure the AJP redirect port is enabled on tomcat/config/server.xml

<Connector port=”8009″ protocol=”AJP/1.3″ redirectPort=”8443″ />

Create a new worker file

sudo vi /etc/apache2/

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

Reconfigure jk.conf

Change the JkWorkersFile property to /etc/apache2/

sudo vi /etc/apache2/mods-available/jk.conf

# JkWorkersFile /etc/libapache2-mod-jk/
JkWorkersFile /etc/apache2/

Configure the URL Apache should pass through the Tomcat

sudo vi /etc/apache2/sites-enabled/000-default

and add the line starts with JKMount in your configurtation

<VirtualHost *:80>
JkMount /gplus* worker1
</VirtualHost *:80>

Restart apache

I found http://<apacheIP>/gplus worked.

Appreciations and thanks to






Apache – Tomcat connector in Windows

This is another interesting assignment completed today. Though our CRM portal is no so busy, we want to in a robust infra. There are series of new releases available kn the market. JDK 7, Tomcat 7 etc. Previously the application was using tomcat itself as a web server. This is a risky situation since I expose the complete applivation to public. Hence I have installed the apache as web front-end and tomcat 7 as middleware.

Here is the procedure:

mod_proxy_ajp would be the easiest to use if you are using Apache 2.2. It is part of the Apache distribution so you don’t need to install any additional software.

In your httpd.conf you need to make sure that mod_proxy and mod_proxy_ajp are loaded:

LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/

Then you can use the ProxyPass and ProxyPassReverse directives as follows:

ProxyPass /portal ajp://localhost:8009/portal
ProxyPassReverse /portal ajp://localhost:8009/portal

As simple as that.