首先到官方网站下载httpd-2.2.13.tar.bz2,jakarta-tomcat-connectors-1.2.15-src.tar.gz和apache-tomcat-5.5.12.tar.gz
1.安装apache
bunzip2 httpd-2.2.13.tar.bz2
tar Ixvf httpd-2.2.13.tar
cd httpd-2.2.13
mkdir -p /usr/local/apache2
./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite
make
make install
2.安装Tomcat。
cp apache-tomcat-5.5.12.tar.gz /usr/local/
cd /usr/local
tar xzvf apache-tomcat-5.5.12.tar.gz
ln -s apache-tomcat-5.5.12 tomcat
3..编译生成mod_jk
tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src/jk/native
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/
4..配置
在/usr/local/apache2/conf/下面建立两个配置文件mod_jk.conf和workers.properties
1) mod_jk.conf内容如下
#指出mod_jk模块工作所需要的工作文件workers.properties的位置
JkWorkersFile /usr/local/apache2/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache2/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 /* worker1
#JkMount /*.jsp worker1
2)workers.properties内容如下
# Defining a worker named worker1 and of type ajp13
worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
#tomcat机子IP地址
worker.worker1.host=127.0.0.1
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
2) 修改httpd.conf
1. 将Listen 80 修改为 Listen 192.168.1.199:80
2. 将ServerName 修改为 ServerName localhost:80
3. 在DirectoryIndex中添加 index.jsp或者把index.html更改为index
4. 修改DocumentRoot
DocumentRoot "/home/project"
<Directory "/home/project ">
Options Includes FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
XBitHack on
</Directory>
<Directory "/home/project/WEB-INF">
Order deny,allow
Deny from all
</Directory>
5. 增加加载mod_jk的语句
LoadModule jk_module modules/mod_jk.so
Include /usr/local/apache2/conf/mod_jk.conf
5.修改tomcat/conf/server.xml
在host下添加如下语句
<Context path="" docBase="/home/project/ynd" debug="0" reloadable="true" crossContext="true"/>