1、准备,下载需要的文件。这里假定你已经正确安装配置好了JDK。
到Apache官方网站下载所需要的文件:
httpd-2.2.4.tar.gz
apache-tomcat-5.5.12.tar.gz
jakarta-tomcat-connectors-1.2.15-src.tar.gz
2.安装Apache
#tar zxvf httpd-2.2.4.tar.bz2
#cd httpd-2.2.4
#./configure \
--prefix=/usr/local/apache \
--sysconfdir=/etc/httpd \
--enable-so \
--enable-ssl \
--with-ssl=/usr/local/ssl \
--enable-track-vars \
--enable-rewrite \
--with-zlib \
--enable-mods-shared=most \
--enable-suexec \
--with-suexec-caller=daemon
#make
#make instal
3.安装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 4.
编译生成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/
5.配置
在/etc/httpd/conf.d下新建两个文件mod_jk.conf和workers.properties
#vi /etc/httpd/conf.d/mod_jk.conf
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
# vi /etc/httpd/conf.d/workers.properties ps=/# Define 1 real worker using ajp13
worker.list=tomcatA,tomcatB,...//tomcatA,tcomcatB为tomcat服务名
worker.tomcatA.type=ajp13worker.tomcatA.port=8000worker.tomcatA.connect_timeout=1000
worker.tomcatB.type=ajp13
worker.tomcatB.port=8001
worker.tomcatB.connect_timeout=1000
...
修改/etc/httpd/httpd.conf
LoadModule jk_module
modules/mod_jk.so
Include /etc/httpd/conf.d/mod_jk.confNameVirtualHost *:80
ServerAdmin dd@dd.com
DocumentRoot /localfile
ServerName //server name or IP
JkMount /* tomcatA
ErrorLog logs/tomcatA.kjqk-error_log
CustomLog logs/tomcatA.kjqk-access_log common
最后编辑Tomcat的配置文件server.xml,在HOST段中加入:
8001"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />//就是worker里面要连接的端口
localfile" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
阅读(1197) | 评论(0) | 转发(0) |