Linux下Apache-Tomcat整合安装
时间:2007-02-18 来源:PHP爱好者
1.安装PHP+Mysql+Apache2
...
注意,Apache要带上--enable-so
2.安装JDK环境
到Java网站下载:
j2sdk-1_4_2_07-linux-i586.bin
#chmod a+x j2sdk-1_4_2_07-linux-i586.bin
#./j2sdk-1_4_2_07-linux-i586.bin
#mv j2sdk-1_4_2_07 /usr/local/jdk
#vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
如果是RHEL3的话,还需要删除原来的空Java环境
#rm -f /usr/bin/java
#rm -f /usr/bin/javac
#rm -f /etc/alternatives/java
#rm -f /etc/alternatives/javac
重新登录
#java -version
查看是否正确.
3.安装Tomcat
到Apache的网站上下载:
jakarta-tomcat-5.0.30.tar.gz
#tar xzvf jakarta-tomcat-5.0.30.tar.gz
#mv jakarta-tomcat-5.0.30 /usr/local/tomcat
运行/usr/local/tomcat/bin/startup.sh启动Tomcat,
http://IP:8080/查看是否安装成功.
4.安装mod_jk2
下载:
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
#tar zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
#cd jakarta-tomcat-connectors-jk2-2.0.4-src/
#cd jk/native2
#./configure --with-apxs2=/usr/local/apache2/bin/apxs
#make
#cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache2/modules
(如果不成功,有提示错误的话,请安装libtool的高版本:
http://www.gnu.org/software/libtool/
tar zxvf libtool-1.5.14.tar.gz
cd libtool-1.5.14
./configure
make
make install
)
5.配置
a.httpd.conf(/usr/local/apache2/conf/)
不让/WEB-INF下的文档暴露
Order allow,deny
Deny from all
加载jk2模块
LoadModule jk2_module modules/mod_jk2.so
b.workers2.properties(/usr/local/apache2/conf/此文件为新建)
[logger.apache2]
level=info #日志级别
[shm]
file=/var/logs/httpd/shm.log
size=1048576 #这个不知道干什么的??
[channel.socket:localhost:8009]
port=8009 #apache和tomcat的通讯端口
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
c./usr/local/tomcat/conf/server.xml
在前面加上:
6.启动测试
启动Tomcat和Apache测试.
7.启动脚本
可以在/etc/init.d/下面,按照httpd格式建一个启动脚本,
用
/usr/local/tomcat/bin/startup.sh启动
/usr/local/tomcat/bin/shutdown.sh停止
注意,脚本前要加上/etc/profile里的环境变量.
chkconfig --add tomcat
chkconfig tomcat on
...
注意,Apache要带上--enable-so
2.安装JDK环境
到Java网站下载:
j2sdk-1_4_2_07-linux-i586.bin
#chmod a+x j2sdk-1_4_2_07-linux-i586.bin
#./j2sdk-1_4_2_07-linux-i586.bin
#mv j2sdk-1_4_2_07 /usr/local/jdk
#vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib
如果是RHEL3的话,还需要删除原来的空Java环境
#rm -f /usr/bin/java
#rm -f /usr/bin/javac
#rm -f /etc/alternatives/java
#rm -f /etc/alternatives/javac
重新登录
#java -version
查看是否正确.
3.安装Tomcat
到Apache的网站上下载:
jakarta-tomcat-5.0.30.tar.gz
#tar xzvf jakarta-tomcat-5.0.30.tar.gz
#mv jakarta-tomcat-5.0.30 /usr/local/tomcat
运行/usr/local/tomcat/bin/startup.sh启动Tomcat,
http://IP:8080/查看是否安装成功.
4.安装mod_jk2
下载:
jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
#tar zxvf jakarta-tomcat-connectors-jk2-2.0.4-src.tar.gz
#cd jakarta-tomcat-connectors-jk2-2.0.4-src/
#cd jk/native2
#./configure --with-apxs2=/usr/local/apache2/bin/apxs
#make
#cp ../build/jk2/apache2/mod_jk2.so /usr/local/apache2/modules
(如果不成功,有提示错误的话,请安装libtool的高版本:
http://www.gnu.org/software/libtool/
tar zxvf libtool-1.5.14.tar.gz
cd libtool-1.5.14
./configure
make
make install
)
5.配置
a.httpd.conf(/usr/local/apache2/conf/)
不让/WEB-INF下的文档暴露
Order allow,deny
Deny from all
加载jk2模块
LoadModule jk2_module modules/mod_jk2.so
b.workers2.properties(/usr/local/apache2/conf/此文件为新建)
[logger.apache2]
level=info #日志级别
[shm]
file=/var/logs/httpd/shm.log
size=1048576 #这个不知道干什么的??
[channel.socket:localhost:8009]
port=8009 #apache和tomcat的通讯端口
host=127.0.0.1
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
[uri:/*.jsp]
worker=ajp13:localhost:8009
[uri:/servlet/*]
worker=ajp13:localhost:8009
c./usr/local/tomcat/conf/server.xml
在前面加上:
6.启动测试
启动Tomcat和Apache测试.
7.启动脚本
可以在/etc/init.d/下面,按照httpd格式建一个启动脚本,
用
/usr/local/tomcat/bin/startup.sh启动
/usr/local/tomcat/bin/shutdown.sh停止
注意,脚本前要加上/etc/profile里的环境变量.
chkconfig --add tomcat
chkconfig tomcat on
相关阅读 更多 +