Configuring Mod_JK 1.2 with Apache httpd 2.2
1. install Apache Httpd server# intall path, ie. /apache2.2
gunzip -d httpd*.tar.gz
tar -xvf httpd*.tar
cd httpd*
./configure --prefix=/ apache2.2 --enable-ssl
make
make install
2. download mod_jk load balancing module for Apache Httpd Server
http://tomcat.apache.org/download-connectors.cgi?Preferred=http://www.apache.org/dist/
3. compile & install mod_jk
gunzip *jk*.tar.gz
tar -xvf *jk(.tar
cd *jk*/native
./configure --with-apxs=/apache2.2/bin/apxs
cp apache-2.0/mod_jk.so /apache2.2/modules/
4.edit Apache Httpd conf/httpd.conf
# add the following line
include "conf/mod_jk.conf"
5. create mod_jk.conf within conf/ directory of Apache Httpd Server
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
JkShmFile logs/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus/>
JkMount status
Order deny,allow
Allow from all
</Location>
#JkMount /*.html loadbalancer
JkMount /*.seam loadbalancer
6. create workers.properties within conf/ directory of Apache Httpd Server
#Definelistofworkersthatwillbeused
#formappingrequests
worker.list=loadbalancer,status
worker.maintain=60
#worker.node0-templateThis feature has been added in jk 1.2.19
worker.node_template.port=8009
worker.node_template.type=ajp13
worker.node_template.lbfactor=1
worker.node_template.socket_timeout=600
worker.node_template.lbfactor=1
#worker.node1
worker.node1.reference=worker.node_template
worker.node1.host=10.18.2.161
#worker.node2
worker.node2.reference=worker.node_template
worker.node2.host=10.18.2.162
#worker.loadbalancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=1
#worker.status
#Status worker for managing load balancer
worker.status.type=status
7 Edit Tomcat/JBoss server.xml
for tomcat: config/server.xml or
for jboss : server/<server name>/deploy/jbossweb.sar
add jvmRoute attribute to Engine element, eg:
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
8 Done!
页:
[1]