- 环境:
windowsxp
j2sdk1.4.2_08
apache2.0.55(http://apache.justdn.org/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi)
mod_jk-apache-2.0.55.so (http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.15/mod_jk-apache-2.0.55.so)
- apache和tomcat的安装(略)
- apache整合tomcat步骤:
- copy mod_jk-apache-2.0.55.so 到Apache2\modules下
- 打开Apache2\conf下的httpd.conf
- 查找"DirectoryIndex", 在index.html的后面添加index.jsp并保存,注意相互之间应有空格。 (DirectoryIndex index.html index.htm index.jsp)
- 找到ServerName并将ServerName改为:ServerName localhost
- 找到DocumentRoot并将DocumentRoot改为:DocumentRoot "web目录(如:d:\myWebRoot)"
- 在httpd.conf最后加如下:
#
LoadModule jk_module modules/mod_jk-apache-2.0.55.so
#
#config of mod_jk
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
#
JkMount /* worker1
JkMount /*/* worker1
JkMount /*/*/* worker1
JkMount /*/*/*/* worker1
#
# End of mod_jk
4. 在apache的conf目录下新建workers.properties 内容如下:
workers.tomcat_home=C:\Tomcat5
workers.java_home=C:\j2sdk1.4.2_08
ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=50
5. 测试
1.启动Apache2.0.55与Tomcat5 .0.30。
2.在%DocumentRoot%目录下创建一个index.jsp文件
2.在地址栏中分别输入
http://localhost/ ,与
http://localhost:8080/若结果相同,说明整合成功。