我与TOMCAT不得不说的二三事
2、 利用mod_jk2.so(也叫JK2)整合
jk2是一个jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip文件,主要用的是其中的mod_jk2.so。其实利用mod_jk2.so整合和利用mod_jk_1.2.5_2.0.47.dll整合大同小异,只是换了个联接器而已,现在一步一步整起来~
步骤1:没有多说的,安装好TOMCAT和APACHE
下载jakarta-tomcat-connectors-jk2.0.4-win32-apache2.0.49.zip,解压,将mod_jk2放到apache的安装文件夹下的modules文件夹中。
步骤2:apache配置
在/conf中加入一个work.properties文件,其内容如下:
[shm]
file=D:/ /Apache2/logs/shm.file
size=1048576
#The socket channel
[channel.socket:localhost:8009]
port=8009
host=localhost
#define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
#uri mapping
[uri:/*] #和第一种方式一样吧^_^
[uri:/*.jsp]
[uri:/*.do]
worker=ajp13:localhost:8009
在httpd.conf中,在LoadModule那里加入这句:
LoadModule jk2_module modules/mod_jk2.so
在最后加入这句:
JkSet config.file "conf/work.properties"
这是告诉apache去哪里找jk的配置的,根据具体情况修改。
还要修改一下DirectoryIndex,DirectoryIndex index.html index.html.var index.jsp查找“listen”用于本机测试时:Listen 127.0.0.1:80,我的是这样设置的Listen *:80。
当然还有我们的虚拟目录:
ServerAdmin darkxie@hotmail.com
DocumentRoot F:/uutang/uutang
ServerName dark
ErrorLog logs/ErrorLog.txt
CustomLog logs/CustomLog.txt common
#JkMount /servlet/* ajp13
#JkMount /*.jsp ajp13
#JkMount /*.do ajp13
步骤3:tomcat配置
Tomcat的端口设置为8080。
在/conf文件夹加入jk2.properties文件,其内容如下:
# Set the desired handler list
handler.list=apr,request,channelSocket
#
# Override the default port for the socketChannel
channelSocket.port=8009
TOMCAT自己已经生成了这个文件,找到相关的地方把注视去掉改一下就成。
注意:用这种方式整合最好是自己编译mod_jk2.so文件,特别是在unix/linux下,我没有环境,制作mod_webapp.so没有自己作过。具体方法,自己去找吧。
