在apache配置文件内引入该模块: vi /etc/httpd/conf/httpd.conf
插入 LoadModule jk_module modules/mod_jk.so
在apache的 conf.d目录下,添加有关mod_Jk的配置: vi /etc/httpd/conf.d/mod_jk.conf
###### 指出mod_jk模块工作所需要的工作文件workers.properties的位置
JkWorkersFile /etc/httpd/conf/workers.properties
###### Where to put jk logs
JkLogFile /var/log/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
添加workers.properties文件: vi /etc/httpd/conf/workers.properties
worker.list=worker1,worker2,worker3,worker4,worker5,loadbalance1,jkstatus
####### Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8031
worker.worker1.lbfactor=50
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
####### Set properties for worker2
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8033
worker.worker2.lbfactor=50
worker.worker2.socket_keepalive=1
worker.worker2.socket_timeout=300
####### Set properties for worker3
worker.worker3.type=ajp13
worker.worker3.host=localhost
worker.worker3.port=8035
worker.worker3.lbfactor=50
worker.worker3.socket_keepalive=1
worker.worker3.socket_timeout=300
####### Set properties for worker4
worker.worker4.type=ajp13
worker.worker4.host=localhost
worker.worker4.port=8037
worker.worker4.lbfactor=50
worker.worker4.socket_keepalive=1
worker.worker4.socket_timeout=300
####### Set properties for worker5
worker.worker5.type=ajp13
worker.worker5.host=localhost
worker.worker5.port=8039
worker.worker5.lbfactor=50
worker.worker5.socket_keepalive=1
worker.worker5.socket_timeout=300
##set loadbalance 1 这里是负载均衡部分,使用了session sticky功能
worker.loadbalance1.type=lb
worker.loadbalance1.balance_workers=worker1,worker2,worker3,worker4,worker5
worker.loadbalance1.sticky_session=true
# Define a 'jkstatus' worker using status
worker.jkstatus.type=status