一起学习
经过一番折腾,总算搞定了apache与tomcat的整合问题,操作如下:
安装jdk到c:jdk
下载apache
下载tomcat
下载apache tomcat 连接器 最高版本,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/"
Options Indexes MultiViews
AddOutputFilter Includes html
AllowOverride None
Order allow,deny
Allow from all
在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增加一行内容:
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,运行与运行:8080/web/test.jsp结果相同即成功。
下载本文示例代码
apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合apache2.0.47 tomcat5.0.12整合
阅读(320) | 评论(0) | 转发(0) |