使用環境:apache_2.0.55,jboss4.0.4分別下載apache_2.0.55-win32-x86-no_ssl.msi,mod_jk-apache-2.0.55.so,jboss-4.0.4.GA.zip
配置主要步驟一、配置apache 1.修改%apache%/conf/httpd.conf的末尾加 Include conf/mod_jk.conf 2.在%apache%/conf下面建立檔案mod_jk.conf ,內容如下:#載入mod_jk Module#LoadModule jk_module modules/mod_jk.soLoadModule jk_module modules/mod_jk-apache-2.0.55.so#指定 workers.properties檔案路徑JkWorkersFile conf/workers.properties# Where to put jk logsJkLogFile logs/mod_jk.log# Set the jk log level [debug/error/info]JkLogLevel infoJkLogStampFormat "[%a %b %d %H:%M:%S %Y] "JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories# JkRequestLogFormat set the request formatJkRequestLogFormat "%w %V %T"# Mount your applications#JkMount /application/* loadbalancerJkMount /* loadbalancer#JkMount /*.* loadbalancer# You can use external file for mount points.# It will be checked for updates each 60 seconds.# The format of the file is: /url=worker# /examples/*=loadbalancerJkMountFile conf/uriworkermap.propertiesJkShmFile logs/jk.shm# Add jkstatus for managing runtime data其中JkMount /* loadbalancer的意思是,把所有的請求都發給loadbalancer處理。可以通過修改url來控制發送某些request。
3.在%apache%/conf下建立檔案 workers.properties 其內容為:# Define list of workers that will be used# for mapping requestsworker.list=loadbalancer,status# Define Node1# modify the host as your host IP or DNS name.worker.node1.port=8099worker.node1.host=localhostworker.node1.type=ajp13worker.node1.lbfactor=1worker.node1.local_worker=1worker.node1.cachesize=10# Define Node2# modify the host as your host IP or DNS name.worker.node2.port=8009worker.node2.host= 192.168.130.99worker.node2.type=ajp13worker.node2.lbfactor=0# Define Node3# modify the host as your host IP or DNS name.worker.node3.port=8009worker.node3.host= 192.168.130.112worker.node3.type=ajp13worker.node3.lbfactor=1# Load-balancing behaviourworker.loadbalancer.type=lbworker.loadbalancer.balance_workers=node1#,node2,node3worker.loadbalancer.sticky_session=1#worker.list=loadbalancer# Status worker for managing load balancerworker.status.type=status
二、配置jboss修改/jbossweb-tomcat55.sar/META-INF/jboss-service.xml找到UseJK,改為true.
修改/jbossweb-tomcat55.sarserver.xml修改應用下面的web.xml增加jboss-web.xml