一。软件准备
apache httpd-2.0.58.tar.gz
tomcat jakarta-tomcat-5.5.9.tar.gz
mod_jk.so jakarta-tomcat-connectors-1.2.14-src.tar.gz
JDK jdk-1_5_0_08-linux-i586.bin
二。安装apache
tar xzvf httpd-2.0.58.tar.gz
cd httpd-2.0.58
./configure --prefix=/usr/local/apache --enable-so
make
make install
三。安装tomcat
tar xzvf jakarta-tomcat-5.5.9.tar.gz
mv jakarta-tomcat-5.5.9 /usr/local/tomcat
四。安装JDK
sh jdk-1_5_0_08-linux-i586.bin
mv jdk1.5.0_08 /usr/local/jdk
分别编辑tomcat的启动和关闭脚本,加入下面这句
export JAVA_HOME=/usr/local/jdk
五。安装mod_jk.so
tar xzvf jakarta-tomcat-connectors-1.2.14-src.tar.gz
cd jakarta-tomcat-connectors-1.2.14-src/jk/native
./configure --with-apxs=/usr/local/apache/bin/apxs
make
cp ./apache-2.0/mod_jk.so /usr/local/apache/modules/
六。配置apache
在apache的配置文件目录中,新建两个配置文件mod_jk.conf和workers.properties。
mod_jk.conf内容如下:
# 指出mod_jk模块工作所需要的工作文件workers.properties的位置
JkWorkersFile /usr/local/apache/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理
JkMount /servlet/* worker1
JkMount /*.jsp worker
workers.properties内容如下:
# Defining a worker named worker1 and of type ajp13
worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
编辑apache的配置文件httpd.conf
在DirectoryIndex中添加 index.jsp
增加关于加载mod_jk的语句:
LoadModule jk_module modules/mod_jk.so
Include /usr/local/apache/conf/mod_jk.conf
七。配置tomcat
编辑tomcat配置文件server.xml
找到段,在其中加入如下:
八。测试
删除/usr/loca/apache/htdocs下所有文件,然后建立一个index.jsp文件
分别启动apache和tomcat
用浏览器访问 应该可以看到正确的页面了
阅读(731) | 评论(0) | 转发(0) |