#
# Defining a worker named ajp12 and of type ajp12
# Note that the name and the type do not have to match.
#
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp12.lbfactor=1
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1
#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize
#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13
#
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes
#
# The XML parser provided with Tomcat
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar
#
# Javac as available from Java2SE
#
worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar
#
# Setting the command line for tomcat
# Note: The cmd_line string may not contain spaces.
#
worker.inprocess.cmd_line=-config
worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml
worker.inprocess.cmd_line=-home
worker.inprocess.cmd_line=$(workers.tomcat_home)
#
# The JVM that we are about to use
#
# This is for Java2
#
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
#
# And this is for jdk1.1.X
#
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll
#
#
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr
#
# Setting the tomcat.home Java property
#
worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#
# Java system properties
#
# worker.inprocess.sysprops=java.compiler=NONE
# worker.inprocess.sysprops=myprop=mypropvalue
# $Header: /home/cvs/jakarta-tomcat/src/etc/Attic/workers.properties,v 1.3.2.2 2000/10/16 01:59:22 larryi Exp $
# $Revision: 1.3.2.2 $
# $Date: 2000/10/16 01:59:22 $
#
#
# workers.properties -
#
# This file provides jk derived plugins with with the needed information to
# connect to the different tomcat workers.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)something
#
# the final value for y will be valuesomething
#
# Normaly all you will need to modify is the first properties, i.e.
# workers.tomcat_home, workers.java_home and ps. Most of the configuration
# is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and ps
# you should have 3 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list property.
#
#
#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=E:\Apache Tomcat 4.0
#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=e:\jdk1.3
#
# You should configure your environment slash... ps= on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=\
# ps=/
#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
worker.list=ajp12, ajp13
我如下配置:
LoadModule jk_module modules/mod_jk.dll
# Declare the module for <IfModule directive>
AddModule mod_jk.c
# Where to find workers.properties
JkWorkersFile D:\Program Files\Apache Group\Tomcat 4.1\conf\workers.properties
# Where to put jk logs
JkLogFile D:\Program Files\Apache Group\Apache2\logs\mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Static files in all Tomcat webapp context directories are served by apache
JkAutoAlias D:\Program Files\Apache Group\Tomcat 4.1\webapps
# All JSP will goes to ajp13
JkMount /*.jsp ajp13
# All servlets goes to ajp13
JkMount /*/servlet/ ajp13
6.安裝tomcat 4.1.12
下載http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/bin/jakarta-tomcat-4.1.12.tar.gz
在/user路徑下建立名稱為tomcat的文件夾。
在jakarta-tomcat-4.1.12.tar.gz所在路徑下,
tar xzvf jakarta-tomcat-4.1.12.tar.gz
cd jakarta-tomcat-4.1.12
將jakarta-tomcat-4.1.12路徑下的所有檔拷貝到/user/tomcat目錄下。
7.創建mod_jk
a.下載http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.1.12/src/jakarta-tomcat-connectors-4.1.12-src.tar.gz 至臨時目錄。
tar xzvf jakarta-tomcat-connectors-4.1.12-src.tar.gz
b.下載並安裝libtools from ftp://ftp.gnu.org/gnu/libtool/libtool-1.4.2.tar.gz
tar xzvf libtool-1.4.2.tar.gz
cd libtool-1.4.2
./configure
make
make install
c.下載並安裝 libtools from ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.53.tar.gz
tar xzvf autoconf-2.53.tar.gz
cd autoconf-2.53
./configure
make
make install
d.下載並安裝libtools from ftp://ftp.gnu.org/gnu/automake/automake-1.6.3.tar.gz
tar xzvf automake-1.6.3.tar.gz
cd automake-1.6.3
./configure
make
make install
e.下載ant:
下載http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/bin/jakarta-ant-1.5-bin.zip
到臨時目錄。
tar xzvf jakarta-ant-1.5-bin.zip
cd /usr/local
mkdir jakarta-ant
拷貝jakarta-ant-1.5-bin目錄下的所有檔至 /usr/local/jakarta-ant 路徑下
i. cd jakarta-tomcat-connectors-4.1.12-src/coyote/
拷貝coyote /build.properties.sample為coyote /build.properties,並編輯它:
catalina.home= ../../jakarta-tomcat/build/tomcat
改為
catalina.home=/user/tomcat
j. cd jakarta-tomcat-connectors-4.1.12-src/util/
ant
k. cd jakarta-tomcat-connectors-4.1.12-src/coyote/
ant
l. cd jakarta-tomcat-connectors-4.1.12-src/jk/
ant
cd jakarta-tomcat-connectors-4.1.12-src/jk/native
./buildconf.sh
./configure --with-apxs=/user/local/bin/apxs --with-java-home=${JAVA_HOME}
make
make install
執行完畢後應該在 /user/local/modules/目錄下存在mod_jk.so文件。
8.配置tomcat
編輯/user/tomcat/conf/server.xml文件
a.
Verify that the following lines are immediately after the <Server port="8005" ...> declaration:
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
modJk="/user/local/modules/mod_jk.so" jkDebug="info"
workersConfig="/user/local/tomcat/conf/jk/workers.properties"
jkLog="/user/tomcat/logs/mod_jk.log"/>
b. Add the following lines after the <Service name="Tomcat-Standalone"> declaration:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
c.Finally, after any <Host name="localhost"> declarations, add a listener
<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig"
append="true" />