apache与tomcat联接配置
apache与tomcat连接配置安装apachewget http://mirror.bit.edu.cn/apache//httpd/httpd-2.2.22.tar.gztar
apache与tomcat连接配置
安装apache- wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.2.22.tar.gz
- tar xzf httpd-2.2.22.tar.gz
- cd httpd-2.2.22
- ./configure --prefix=/usr/local/apache
- make && make install
安装jk_mod模块- wget http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.33-src.tar.gz
- tar xzf tomcat-connectors-1.2.33-src.tar.gz
- cd tomcat-connectors-1.2.33-src/native
- ./configure --with-apxs=/usr/local/apache/bin/apxs
- make && make install
apache与tomcat连接配置
配置与tomcat连接主要有三个文件:
httpd.conf,workers.properties,uriworkermap.properties
1、httpd.conf
- # 加载 mod_jk 模块
- LoadModule jk_module modules/mod_jk.so
- #
- # 配置mod_jk模块
- #
- <IfModule jk_module>
- JkWorkersFile conf/workers.properties
- JkMountFile conf/uriworkermap.properties
- JkLogFile logs/mod_jk.log
- JkLogLevel warn
- </IfModule>
2、workers.properties
- #定义两个可用的worker wlb和jkstatus
- worker.list=wlb,jkstatus
-
- #定义一个物理为ajp13w,类型ajp13(可以定义多个用作负载均衡)
- worker.ajp13w.type=ajp13
- worker.ajp13w.host=localhost
- worker.ajp13w.port=8009
-
- #定义一个逻辑worker wlb,类型为lb,用来管理物理worker ajp13w
- worker.wlb.type=lb
- worker.wlb.balance_workers=ajp13w
-
- #定义一个类型为status的worker jkstatus,用来监控 JK 本身
- worker.jkstatus.type=status
3、uriworkermap.properties
- #这文件作用是指定哪些url由worker wlb处理,哪些文件不允许wlb处理。
- /*=wlb
- /status=jkstatus
- /examples/*=wlb
- !/*.jpg=wlb
- !/*.png=wlb
- !/*.css=wlb
- !/*.js=wlb
- !/*.htm=wlb
- !/*.html=wlb
-
- #/jkstatus由worker status处理,静态的由apache处理,剩下的由wlb处理。
更过信息请查看 tomcat教程 http://www.itchm.com/forum-50-1.html