The following steps are useful in integrating Apache 1.3.26 with Tomcat 4.0.4.
Downloads:
a) Download Apache 1.3.26 from http://www.apache.org/dist/httpd/binaries/win32/
b) Download Tomcat 4.0.4 from http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/bin/
Installing Apache and Tomcat is straightforward. I assume that Apache is installed at C:\Apache\Apache. Hereafter, I would refer $APACHE_HOME for Apache home directory in this document. Similarly, I assume that Tomcat is installed at C:\Tomcat. Hereafter I would refer $CATALINA_HOME for Tomcat home directory in this document.
Integration:
The important piece comes here. Follow the steps carefully to successfully integrate Apache with Tomcat using AJP connector.
Locate and download the Win32 file mod_jk.dll. Move mod_jk.dll to $APACHE_HOME/modules.
####################################
# Edit server.xml under $CATALINA_HOME/conf/
####################################
If it is not already, uncomment the AJP connector section in $CATALINA_HOME/conf/server.xml. This section starts with
“<!-- Define an AJP 1.3 Connector on port 8009 -->”.
The next lines should now read:
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
Next we need to create a server listener to generate the Apache directives.
If you are NOT using virtual hosts, look somewhere around line 13 for the following:
<Server port="8005" shutdown="SHUTDOWN" debug="0">
Right under this, insert the following:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" modJk= “$APACHE_HOME/modules" />
If you are using virtual hosts, look for the following line at around line 216:
<Host name="localhost" debug="9" appBase="webapps" unpackWARs="true">
Right under this, insert the following:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"append="true" modJk= “$APACHE_HOME/modules/mod_jk.dll” />
The modJk attribute sets the location path to mod_jk.dll.
####################################
# Edit httpd.conf under $APACHE_HOME/conf/
####################################
Add the following after the LoadModule chunk, somewhere around line 197:
#################### Load mod_jk ############################
<IfModule !mod_jk.c>
LoadModule jk_module "$APACHE_HOME/modules/mod_jk.dll"
</IfModule>
JkWorkersFile "$TOMCAT_HOME/conf/jk/workers.properties"
JkLogFile "$TOMCAT_HOME/logs/jk_log.txt"
JkLogLevel debug
A few lines below this should be the AddModule chunk. Add the following in this chunk:
#
# JK
#
AddModule mod_jk.c
Next we need to tell Apache what to forward to Tomcat. At around line 300, the "DocumentRoot" should be defined. Add the following just below this:
JKMount /echain/* ajp13
JkMount /*.jsp ajp13
JkMount /examples/* ajp13
JkMount /manager/* ajp13
JkMount /tomcat-docs/* ajp13
JkMount /webdav/* ajp13
#################
workers.properties
#################
If you execute $CATALINA_HOME/bin/startup.bat, you will see an error indicating that the workers.properties file cannot be found, but the mod_jk.conf will be created.
After doing this, open $CATALINA_HOME/conf, where two directories will be created,
$CATALINA_HOME/conf
----+auto
--------mod_jk.conf
----+jk
--------workers.properties
The jk directory is where the workers.properties file needs to be defined as follows:
#
# Setup for Windows system
#
workers.catalina_home="C:/Tomcat"
workers.java_home="C:/j2sdk1.4.0"
# Windows uses back slashes
ps=\
worker.list= ajp13
# Definition for Ajp13 worker
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
The workers.catalina_home and workers.java_home paths should be set to your specific configuration.
Finally, to start the server do the following:
Load Tomcat.
Load Apache.
Open your web browser and go to http://localhost - this should return an Apache page.
Go to http://localhost/echain/ and this should bring up the index.html.
tomcat-docs/, webdav/ and manager/ should work just fine as well.
Please send your feedback to Kishore Kochi - J2EE Practice Head