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-template	This 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!

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值