1、安装j2sdk
#chmod +x j2sdk-1_4_2_13-linux-i586.bin
#./j2sdk-1_4_2_13-linux-i586.bin
#ln -s /usr/local/j2sdk1.4.2_13/
/usr/local/jdk
2.安装tomcat
#tar -zxvf jakarta-tomcat-5.0.30.tar.gz
#ln -s
/usr/local/jakarta-tomcat-5.0.30/ /usr/local/tomcat
编辑startup.sh 和
shutdown.sh
#vi startup.sh
在“#------------------------”后面添加
export
JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export
CLASSPATH=$JAVA_HOME/lib
#/usr/local/tomcat/bin/startup.sh --启动tomcat
#/usr/local/tomcat/bin/shutdown.sh ---关闭tomcat
#java -version --查看jdk是否安装成功
--查看tomcat是否能够正常运行
3.整合apache和tomcat
安装Fedora-Core-1-i386.tar.gz
#tar -zxvf Fedora-Core-1-i386.tar.gz
#cd Fedora-Core-1-i386
#cp etc/httpd/conf/workers2.properties
/usr/local/apache/conf/
#cp etc/httpd/conf.d/jk2.conf
/usr/local/apache/conf/
#cp usr/lib/httpd/modules/*
/usr/local/apache/modules/
#cp -a usr/share/doc/mod_jk2/
/usr/share/doc/mod_jk2/
#cp -a var/www/manual/mod_jk2/
/usr/local/apache/manual/mod_jk2/
编辑workers2.properties文件,使其运行jsp文件
#vi
/usr/local/apache/conf/workers2.properties
--在文件尾部加上以下语句--
[uri:/*.jsp]
worker=ajp13:localhost:8009
编辑tomcal默认主目录
#vi /usr/local/tomcat/conf/server.xml
unpackWARs="true" autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
--添加此语句,和apache的主目录一致
#killall httpd
#/usr/local/apache/bin/apachectl start
#/usr/local/tomcat/bin/shutdown.sh
#/usr/local/tomcat/bin/startup.sh
编辑测试文件test.jsp
#vi test.jsp
Hello! The time is <%=new
java.util.Date() %>
Hello! The time is Sun Feb 25 05:10:30 CST 2007
4.设置虚拟目录
[root@yangwenjun conf]# vi
/usr/local/apache/conf/httpd.conf
在httpd.conf文档末尾虚拟主机设置处加入以下内容:
NameVirtualHost
*:80
Documentroot
/home/www/apache/htdocs
DocumentRoot /home/bruce/test1
ServerName
test1.yangwenjun.com
DocumentRoot /home/bruce/test2
ServerName
test2.yangwenjun.com
[root@yangwenjun conf]# vi
/home/www/tomcat/conf/server.xml
在server.xml文档的......中间添加两段......
内容如下:
unpackWARs="true" autoDeploy="true"
xmlValidation="false"
xmlNamespaceAware="false">
reloadable="true"
crossContext="true"/>
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
reloadable="true"
crossContext="true"/>
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
本文出自 “聆听未来” 博客,请务必保留此出处http://blog.chinaunix.net/space.php?uid=9419692&do=blog&id=3182643