Home > Uncategorized > Configuring Tomcat with Apache

Configuring Tomcat with Apache

February 2nd, 2011 Leave a comment Go to comments

In this post we will describe how to set up Apache web server with Tomcat.

We have used  Tomcat 6.0.29 and Apache 2.2.17 but the settings describe here will work for Tomcat 7 as well.

1. We will need to install mod_jk on apache

Mod_jk can be downloaded  from this location


2. Copy mod_jk-1.2.30-httpd-2.2.3.so to <Install Location>\Apache Software Foundation\Apache2.2\modules

3. Create a workers.properties in conf folder of apache

A sample workers.properties


# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.

# You should configure your environment slash… ps=\ on NT and / on UNIX
# and maybe something different elsewhere.

# The workers that your plugins should create and work with

#—— DEFAULT ajp13 WORKER DEFINITION ——————————
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.

#—— CLASSPATH DEFINITION —————————————–
# Additional class path components.

# The JVM that we are about to use
# Unix – Sun VM or blackdown

# Setting the place for the stdout and stderr of tomcat

4. Use Tomcat auto configure.

To be added at the end of your httpd.conf

Include $TOMCAT_HOME/conf/jk/mod_jk.conf-auto

5. Re start tomcat and re start Apche.

You will find two folders auto and jk created under TOMCAT_HOME/conf.


You will also find this value inserted in conf.xml

<Listener className=”org.apache.jk.config.ApacheConfig” modJk=”<Your apache directory>/Apache2.2/modules/mod_jk-1.2.30-httpd-2.2.3.so” />

Common Issues:

client denied by server configuration

Apache Error Client Denied By Server Configuration

Reason : By default Apache is configured as restrictive server. It will not allow end users (client) to do anything on default DocumentRoot. To fix this issue you need to add following lines to your VirtualHost configuration directives:

Fix :Add this in your conf file (httpd-vhosts.conf)

<Directory “/var/www/example.com”>
Options -Indexes FollowSymLinks
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all

Categories: Uncategorized Tags:
  1. Naim
    September 27th, 2011 at 15:16 | #1

    i don’t understand what im doing wrong, but ive tried several ways for using tomcat with apache and everytime i get stuck at the same part when you have to restart apache after editing httpd.conf, apache fails to restart.

    any idea what could be the problem ?

  2. February 6th, 2011 at 23:12 | #2

    I do not see any problems in removing apache if you use apache only to server static pages. They can be served from glassfish instead.

  3. sessizlik
    February 6th, 2011 at 16:23 | #3

    hi, thanks for post. I have some question regarding apache and tomcat.

    I have a legacy application. Apache is used together with a Glassfish app server. However with new load balancer what we have today, I want to remove Apache web servers. Cant I use alone Glassfish? (Static resources are loaded from our static web servers. )

  4. Glenn
    February 3rd, 2011 at 12:00 | #4

    oh thanks for the post. i was looking for exactly this set up.

  1. February 2nd, 2011 at 23:22 | #1
  2. March 10th, 2011 at 04:33 | #2