Win32下使用AJP整合Tomcat 4.0.4和Apache 1.3.26

发表于:2007-07-04来源:作者:点击数: 标签:
预备工作: 下载: Apache 1.2.26 http://www.apache.org/dist/httpd/binaries/win32/apache_1.3.26-win32-x86-no_src.exe Tomcat 4.0.4 http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/bin/jakarta-tomcat-4.0.4-LE-jdk14.exe mod_jk ht
预备工作:

下载:
Apache 1.2.26 http://www.apache.org/dist/httpd/binaries/win32/apache_1.3.26-win32-x86-no_src.exe
Tomcat 4.0.4 http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.4/bin/jakarta-tomcat-4.0.4-LE-jdk14.exe
mod_jk http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/win32/i386/mod_jk.dll

安装过程大家都知道, 就不再罗嗦了.

配置Apache:

把mod_jk.dll拷贝到 %APACHE_HOME%/libexec目录下
在%APACHE_HOME%/conf/httpd.conf中添加以下信息:

#... ...
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule jk_module libexec/mod_jk.dll

#... ...
#AddModule mod_unique_id.c
AddModule mod_jk.c

#... ...
JkWorkersFile "D:/Apache/tomcat/work/workers.properties"
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

其中JkWorkersFile为mod_jk工作目录, JkLogFile为mod_jk日志目录.
最后在需要的地方(如VirtualHost中)加入:

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13

保存配置, OK, Apache服务器配置完成, 下面来配置Tomcat.

首先, 新建一个workers.properties文件(要和JkWorkersFile的那个文件名相同),写入以下信息:

# ... ...
workers.tomcat_home=D:/Apache/tomcat
workers.java_home=D:/j2sdk1.4.0
ps=/
worker.list=ajp12, ajp13

# Definition for Ajp13 worker
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

其中workers.tomcat_home为Tomcat的安装路径, workers.java_home为JDK的安装路径
然后保存到D:/Apache/tomcat/work(也就是httpd.conf中JkWorkersFile的路径).

配置Tomcat:

修改%TOMCAT_HOME%/conf/server.xml

1.在<Server></Server>中加入:

<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" />

2.在<Host></Host>中加入:

<Listener className="org.apache.ajp.tomcat4.config.ApacheConfig" append="true" />

保存, OK, 全部配置完成.

测试就不用我再说了吧^_^
有什么问题, 发到webmaster@yipsilon.com

参考:
Tomcat AJP1.3说明文档 http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/ajp.html
那里面还有IIS的配置说明, 快去看看啊!!

原文转自:http://www.ltesting.net