RedHat环境apache 2.2.3与tomcat-5.5.20的简单整..
时间:2007-02-10 来源:zflanna
httpd-2.2.3.tar.gz
jdk-1_5_0_10-nb-5_5-linux.bin
tomcat-connectors-1.2.19-src.tar.gz
apache-tomcat-5.5.20.tar.gz
安装Apache
以root身份执行
# tar xzvf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
安装apr
# cd srclib/apr
# ./configure --prefix=/usr/local/apr
# make
# make install
安装apr-util
# cd ../apr-util/
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install
# cd ../../
#./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-mods-shared=most --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
# make
# make install
配置网站根目录及访问权限
vi httpd.conf
DocumentRoot "/www "
<Directory /www>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
安装Jdk
新建jdk用户,组为javagp,home目录为/usr/local/jdk
jdk的安装目录为/usr/local/jdk/jdk5
图形界面安装需在jdk用户的.bash_profile 中加
DISPLAY=:0.0
export DISPLAY
# chmod +jdk-1_5_0_10-nb-5_5-linux.bin
# ./ jdk-1_5_0_10-nb-5_5-linux.bin
设置环境变量
# vi /etc/profile
PATH=$PATH:/usr/lib:/usr/local/jdk/jdk5/bin:/usr/local/jdk/jdk5/jre/bin
JAVA_HOME=/usr/local/jdk/jdk5
CATALINA_HOME=/usr/local/tomcat/tomcat5
CLASSPATH=./:/usr/local/jdk/jdk5/lib:/usr/local/jdk/jdk5/jre/lib
安装Tomcat
新建tomcat用户,组为javagp,home目录为/usr/local/tomcat
tomcat的安装目录为/usr/local/tomcat/tomcat5
# tar xzvf apache-tomcat-5.5.20.tar.gz
# ln -s apache-tomcat-5.5.20 tomcat
整合Apache与Tomcat
创建mod_jk.so
# tar xzvf tomcat-connectors-1.2.19-src.tar.gz
# cd tomcat-connectors-1.2.19-src/native
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache2/bin/apxs
# make
# cp apache-2.0/mod_jk.so /usr/local/apache2/modules
在httpd.conf中加入
LoadModule jk_module /usr/local/apache2/modules/mod_jk.so
JkWorkersFile /usr/local/tomcat/tomcat5/conf/workers.properties
JkMount /*.jsp ajp13
JkMount /servlet/*.jsp ajp13
# cd /usr/local/tomcat/tomcat5/conf
# vi workers.properties
workers.tomcat_home=/usr/local/tomcat/tomcat5
workers.java_home=/usr/local/jdk/jdk5
配置server.xml
把主机部分修改为
<Host name="localhost" debug="0" appBase="/www" unpackWARs="false" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="iccess." suffix=".log" timestamp="true"/>
<Context docBase="" path="" reloadable="true">
</Context>
<Context docBase="jsp" path="/jsp" reloadable="true">
</Context>
</Host>
在/www/jsp下存放test.jsp文件,如能通过http://IP/jsp/test.jsp访问,说明整合成功。