如何整合apache和tomcat


 整合apache和tomcat的简易操作

【本人测试已成功】

准备:tomcat6.0 apache 2.2.3(或2.2.4) mod_jk.so

注:红色文字为说明,不需要加入到配置文件中去

1.安装JAVA虚拟机,本人安装路径:C:\Program Files\Java

2.安装Tomcat,本人安装路径:C:\Program Files\Apache Software Foundation\Tomcat6.0

3.安装完成后,配置环境变量。操作:我的电脑-》右键-》属性-》高级-》环境变量-》系统变量-》新建(2个新的)

    第1个:变量名:JAVA_HOME  变量值:C:\Program Files\Java\jdk1.6.0_02(你的JDK路径)

    第2个:变量名:TOMCAT_HOME 变量值:C:\Program Files\Apache Software Foundation\Tomcat6.0(你安装的TOMCAT路径)

4。环境变量配置完后,保证TOMCAT没问题后,进行apache和tomcat的整合

5.安装apache,我的安装路径是:D:\Apache2.2

6.在tomcat\conf下加入workers.properties文件,有的话只需修改:内容如下

 workers.tomcat_home=C:\Program Files\Apache Software Foundation\Tomcat6.0
 workers.java_home=
C:\Program Files\Java
ps=\
worker.list=ajp13#


worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar

worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar

worker.inprocess.cmd_line=-config

worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml

worker.inprocess.cmd_line=-home

worker.inprocess.cmd_line=$(workers.tomcat_home)

worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll


worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout

worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr

worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)

7.在D:\Apache2.2\modules(本人的路径)加入mod_jk.so文件

8.修改D:\Apache2.2\conf\httpd\conf

9.DocumentRoot "D:\Tomcat6.0\webapps"#(可以随便定义但是必须保证和Directory的一致)(原:<DocumentRoot "D:\Apache2.2\htdocs">)

<Directory "D:\Tomcat6.0\webapps">#(原:<Directory "D:\Apache2.2\htdocs">)

将LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so前面的#号去掉变成

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#在httpd.conf结尾处加入
LoadModule jk_module modules/mod_jk.so
JkWorkersFile "D:\Tomcat6.0\conf\workers.properties
"#(一开始存放workers.properties的地方)
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
#解析jsp后缀的文件
JkMount /*.do ajp13#解析请求.do的操作,可根据需要跟拦截器差不多的样式配置即可,不过他是表示能通过

 

 

 测试结果:

http://localhost/
如何整合apache和tomcat_第1张图片

 

 

http://localhost:8080/
 
如何整合apache和tomcat_第2张图片
 

 俩路径出现都能看见tomcat首页即可! 

 

你可能感兴趣的:(java,apache,tomcat,C++,jni)