日期:2014-05-16  浏览次数:20797 次

Apache和多Tomcat整合
  • 修改Apache配置

?????????? 找到conf目录下的
???? httpd.conf在文件的最后一行添加
???? include "D:\Program Files\Apache Software Foundation\Apache2.2\conf\mod_jk.conf"

?

?????????

???????? mod_jk.conf :

?????????

LoadModule jk_module modules/mod_jk-apache-2.2.4.so JkMount /servlet/* loadbalancer JkMount /*.jsp loadbalancer JkWorkersFile conf/workers.properties JkLogFile logs/mod_jk.log JkLogLevel info HostnameLookups Off

?


?

??????? worker.properties:

????

#workers.tomcat_home="D:\software\apache-tomcat-6.0.29" workers.java_home="C:\Program Files\Java\jdk1.6.0_13" ps=\ worker.list=tomcat1,tomcat2,loadbalancer worker.tomcat1.port=8009 worker.tomcat1.host=localhost worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor=1 worker.tomcat2.port=9009 worker.tomcat2.host=localhost worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor=1 worker.loadbalancer.type=lb worker.loadbalancer.balanced_workers=tomcat1,tomcat2

?


?

  • 配置Tomcat
  • 将tomcat赋值几份。上例中是2份。修改每份中tomcat的server.xml文件:
    保证server的port,connector为http1.1的port都不相同
    ?AJP13的connector的port和jvmRoute名称和workers.properties中配置对应。
    ? 如:

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost" debug="0" jvmRoute="tomcat1">

?


?