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
http://www.fightrice.com/mirrors/apache//tomcat/tomcat-connectors/jk/binaries/win32/
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.tomcat_home=/usr/local/jakarta-tomcat-4.1.18
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/java2
# You should configure your environment slash… ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/
# The workers that your plugins should create and work with
#
worker.list=worker1
#—— 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.
#
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
#—— CLASSPATH DEFINITION —————————————–
#———————————————————————
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
# The JVM that we are about to use
#
# Unix – Sun VM or blackdown
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)classic$(ps)libjvm.so
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr
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.
http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
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: Read more…