我本人用的不是这个方法,但觉得这遍文章还是不错的,里面好多东西可以学习借鉴。所以转了。
本文来自ChinaUnix博客,如果查看原文请点: http://blog.chinaunix.net/u/26257/showart_277355.html
httpd-2.0.59.tar.gz
jakarta-tomcat-5.5.7.tar.gz
jakarta-tomcat-connectors-1.2.15-src.tar.gz
jdk-1_5_0_08-linux-i586-rpm.bin
1,install apache
tar xzvf httpd-2.0.59.tar.gz
cd httpd-2.0.59
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most
make
make install
/usr/local/apache/bin/apachectl start
ps ax 查看是否有httpd进程
2, install jdk
chmod 755 jdk-1_5_0_08-linux-i586-rpm.bin
./jdk-1_5_0_08-linux-i586-rpm.bin
rpm -ivh jdk-1_5_0_08-linux-i586-rpm
默认安装在/usr/java/jdk1.5.0_08/
3, install tomcat
tar xzvf jakarta-tomcat-5.5.7.tar.gz
mv jakarta-tomcat-5.5.7 /usr/local/tomcat
/usr/local/tomcat/bin/startup.sh 开始
测试 172.16.103.73:8080能看到小猫不?呵呵
4, Configure JAVA_HOME&&TOMCAT_HOME PATH
vi /etc/profile
JAVA_HOME=/usr/java/jdk1.5.0_08
export JAVA_HOME
PATH=$PATH:/usr/java/jdk1.5.0_01/bin
export PATH
export CATALINA_HOME=/usr/local/tomcat
export TOMCAT_HOME=/usr/local/tomcat
5, install mod_jk(apache和tomcat整合)
tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
cd jakarta-tomcat-connectors-1.2.15-src
cd jk/native/
./buildconf.sh
./configure --with-apxs=/usr/local/apache/bin/apxs
make
cp apache-2.0/mod_jk.so /usr/local/apache/modules/
6, vi /usr/local/apache/conf/httpd.conf
添加
LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/usr/local/apache/conf/workers.properties"
JkLogFile "/var/log/mod_jk2.log"
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"
JkLogLevel debug
JkMount /*.jsp worker1
7,添加 workers.properties
cd /usr/local/apache/conf
vi workers.properties
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
8, vi /usr/local/tomcat/conf/server.xml
在最后的位置上前添加
reloadable="true" crossContext="true"/>
docBase="/usr /local/apache/htdocs"该路径于你apache的conf DocumentRoot的路径相同
9,配置虚拟主机
vi /usr/local/apache/conf/httpd.conf
G
去掉 #NameVirtualHost *:80前面的#
在文件最后添加如下
ServerAdmin lqlboy@XX.com
DocumentRoot /var/www/jsp.XX.com
ServerName jsp.xw.com
ErrorLog logs/jsp-error_log
CustomLog logs/jsp-access_log common
ServerAdmin lqlboy@XX.com
DocumentRoot /var/www/mail.XX.com
ServerName mail.XX.com
ErrorLog logs/mail-error_log
CustomLog logs/mail-access_log common
vi /usr/local/tomcat/conf/server.xml
在最后的和之间添加相应的host.如下:
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
reloadable="true" crossContext="true"/>
XP下更该本机hosts测试
注:1)在/usr /local/tomcat/conf/server.xml中添加的Host要与apache's conf中的虚拟主机相配对
2) docBase="/var/www/jsp.XX.com 为jsp页面文件所在文件夹
3) 每次更改/usr/local/tomcat/conf/server.xml或 apache's conf 别忘记重启服务!!
(责任编辑:IT) |