安装jdk到c:jdk
下载apache http://apache.te8.com/dist/httpd/binaries/win32/apache_2.0.47-win32-x86-no_ssl.msi
下载tomcat http://apache.te8.com/dist/jakarta/tomcat-5/v5.0.12-beta/bin/jakarta-tomcat-5.0.12.exe
下载apache tomcat 连接器 http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/v1.2.4/bin/win32/mod_jk_2.0.46.dll 最高版本,2.0.47的没有,不过这个也可同2.0.47工作。
安装tomcat到目录c: omcat,安装apache到c:最后apache主目录为c:apache2,放mod_jk到c:apache2modules目录下
配置apache httpd.conf 使之自动支持中文改AddDefaultCharset ISO-8859-1 为AddDefaultCharset GB2312 在最后增加如下内容:
# Using mod_jk2.dll to redirect dynamic calls to Tomcat
LoadModule jk_module modules/mod_jk.dll
JkWorkersFile "C:/Tomcat/conf/workers.properties"
JkLogFile "C:/Tomcat/logs/mod_jk2.log"
JkLogLevel info
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
增加虚拟目录:
Alias /web "D:/www/"
<Directory "D:/www">
Options Indexes MultiViews
AddOutputFilter Includes html
AllowOverride None
Order allow,deny
Allow from all
</Directory>
在F:Tomcatconf目录下新建文件workers.properties内容如下
workers.tomcat_home=C:Tomcat #让mod_jk模块知道Tomcat
workers.java_home=C:jdk #让mod_jk模块知道j2sdk
ps=
worker.list=ajp13 #模块版本,现有ajp14了,不要修改
worker.ajp13.port=8009 #工作端口,若没占用则不用修改
worker.ajp13.host=localhost #本机,若上面的Apache主机不为localhost,作相应修改
worker.ajp13.type=ajp13 #类型
worker.ajp13.lbfactor=1 #代理数,不用修改
tomcat的server.xml增加一行内容:
<Context path="/web" docBase="D:/www" debug="0" reloadable="true" > </Context>
jk2.properties的内容为:
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.
## COMMENTS WILL BE _LOST_
## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.
# Set the desired handler list
handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
# channelSocket.port=8019
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm
# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:
# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so
# apr.jniModeSo=F:Apache2modulesmod_jk2-2.0.43.dll
# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess
#request.tomcatAuthentication=true
request.tomcatAuthentication=false
完毕。
先启动tomcat后启动apache,运行http://localhost/web/test.jsp与运行http://localhost:8080/web/test.jsp结果相同即成功。
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/
领测软件测试网最新更新
关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073