这两天在windows2000 professional 下进行了Apache2与Tomcat5的整合。这理总结下:
一)安装配置tomcat apache mod_jk j2sdk
1)下载并安装Sun j2sdk1.5.这是必需的基本环境。
下载地址:http://java.sun.com
2)下载Tomcat5.5.16 解压使用就行啦,然后试下Tomcat能不能正常运行。
下载地址:http://tomcat.apache.org/
3)下载Apache2.0.55 windows安装版本,并安装
下载地址:http://httpd.apache.org/
4)下载mod_jk
下载地址:http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/
准备完成后就可以进行配啦:
二)配置
1)把mod_jk-1.2.14-apache-2.0.54.so 改名为mod_jk.so放到apache2/modules/下
2)修改httpd.conf加入:
# load the jk_modules
#include E:/Apache Group/Apache2/conf/mod_jk.conf
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log #可不要
# Set the jk log level [debug/error/info]
JkLogLevel info #可不要
# Send servlet for context /examples to worker named ajp13
#JkMount /servlet/* ajp13
# Send JSPs for context /examples to worker named ajp13
JkMount /*.jsp ajp13
3加入虚拟主机:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin yourmail@.maill.com
DocumentRoot E:/develop/apache-tomcat-5.5.16/webapps/jsp-examples
ServerName localhost
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
2)编写workers.properties 并放配到 apache2 的conf目录下
workers.properties 内容如下:
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost #本机,若上面Tomcat主机不为localhost,作相应修改
worker.ajp13.type=ajp13 #类型
worker.ajp13.lbfactor=1 #代理数,不用修改
3)确认tomcat5的conf/server.xml中已有经下配置:
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
好啦配置完毕,分别起动apache和tomcat.然后输入http://localhost/ 应该会出现tomcat的detault面页啦。