这个贴子可以找到整合用到的dll文件.
把dll文件放到[apache]\modules下。
在tomcat\conf添加文件: workers.properties.
用editplus打开,添加如下代码:
workers.tomcat_home=[tomcat] #让mod_jk模块知道Tomcat
workers.java_home=[java] #让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]\conf\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:\Apache2\modules\mod_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配置文件server.xml。editplus打开,设置虚拟目录,<context path=”” docBase=”” reloadable=”true” debug=”0”></context>.
修改apache的配置文件httpd.conf。推荐用editplus(Courier New 14 pounds)打开httpd.conf. 设置访问的目录232行的<documentroot>,不要忘了还有257行的<directory>。当然也可以添加虚拟目录,就是复制481~488行。把名称改成自己想要的文件夹名。然后写上虚拟目录的物理地址即可。总之怎么改都行,但不要和tomcat跑两个地方去就行了。另外,添加如下代码:
LoadModule jk_module modules/mod_jk2.dll
JkWorkersFile "[tomcat]\conf\workers.properties"
JkLogFile "[tomcat]\logs\mod_jk2.log"
JkLogLevel info
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
<Directory "e:/web">
Options Indexes MultiViews
AddOutputFilter Includes html
AllowOverride None
Order allow,deny
Allow from all
</Directory>
将mod_jk.dll拷贝到Modules目录下
----
E:\JspServer\Tomcat5
conf目录下建立workers.properties
内容如下:
workers.tomcat_home=e:\jspserver\Tomcat5 #让mod_jk模块知道Tomcat
workers.java_home =e:\jspserver\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 #代理数,不用修改
修改Server.xml加入一行
<Context path="/web" docBase="e:/web" 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
# 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=false
--------------------------
重启Tomcat后再重启APACHE..