先安装 jdk-6u10-linux-i586-rpm.bin
https://cds.sun.com/is-bin/INTER ... VariationTypeFilter
#chmod +x jdk-6u10-linux-i586-rpm.bin 命令使其获得可执行权限
#./jdk-6u10-linux-i586-rpm.bin
#rpm -ivh jdk-6u10-linux-i586-rpm
安装完毕,JDK安装在/usr/java/目录下
重命名:mv jdk-6u10-linux-i586-rpm /usr/java/
#vi /etc/profile 设置环境变量
export JAVA_HOME=/usr/java/jdk
export PATH=$PATHJAVA_HOME/binJAVA_HOME/jre/bin
export CLASSPATH==.JAVA_HOME/libJAVA_HOME/jre/libCLASSPATH
export TOMCAT_HOME=/opt/tomcat
# java -version 如果出现相关JDK版本信息,证明成功
Tomcat5.5下载地址
http://tomcat.apache.org/download-55.cgi
http://www.fs2you.com/files/569e3297-052c-11dd-80d3-0014221b798a/
apache-tomcat-5.5.26.tar.gz
#tar xzvf apache-tomcat-5.5.26.tar.gz
#mv apache-tomcat-5.5.26 /opt/tomcat/
#source /etc/profile #不重启 加载环境变量
#./bin/startup.sh
http://ip:8080 测试
修改conf/server.xml
改80端口 <Connector port="80" maxHttpHeaderSize="8192"
改域名和网站目录 webapps/Root/
</Host>
<Host name="bbs.777.cn" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="/home/wwwjsp/" debug="0" reloadable="true" crossContext="true"/>
</Host>
编译安装Apache:
http://www.fs2you.com/files/d0a86c99-07a3-11dd-9cf5-0014221f4662/
进入apache源码包所在目录
#tar -zxvf ./httpd-2.2.8.tar.gz
#cd httpd-2.2.8
#./configure --prefix=/usr/local/apache --enable-modules=so --enable-so注:--prefix参数用来指定安装后存放的路径,--enable-modules用来指定系统允许使用的功能扩展的类型,这里指定为so类型,--enable-so用来指定允许DSO(动态共享对像)
#echo $?
显示为:0,表示编译过程中没有错误,显示其它都有错 这一步后面的编译过程都会用到,如果在这出错了,就不要MAKE了。得查找原因。
#make
#make install
设置apache虚拟主机
NameVirtualHost 61.152.169.65
ServerName 61.152.169.65
<VirtualHost 61.152.169.65>
ServerName www.777.cn
DocumentRoot /home/wwwhtml
<Directory "/home/wwwhtml">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost 61.152.169.65>
ServerName bbs.777.cn
DocumentRoot /home/wwwjsp
<Directory "/home/wwwjsp">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
在DirectoryIndex中添加 index.jsp
增加关于加载mod_jk的语句:
LoadModule jk_module modules/mod_jk.so
Include /usr/local/apache2/conf/mod_jk.conf
安装编译生成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/apache/bin/apxs
# make
# cp ./apache-2.0/mod_jk.so /usr/local/apache/modules/
在/usr/local/apache/conf/下面建立两个配置文件mod_jk.conf和workers.properties。
vi mod_jk.conf
# 指出mod_jk模块工作所需要的工作文件workers.properties的位置
JkWorkersFile /usr/local/apache/conf/workers.properties
# Where to put jk logs
JkLogFile /usr/local/apache/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理
JkMount /servlet/* worker1
JkMount /*.jsp worker1
# vi workers.properties
添加以下内容:
代码:
# Defining a worker named worker1 and of type ajp13worker.list=worker1
# Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
vi index.jsp 测试页面
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<html>
<body bgcolor="blue">
<center>
<%= request.getSession().getId() %>
<h1>Tomcat 2</h1>
</body>
</html>
#<html>
#<body>
# <center>Now time is: <%=new java.util.Date()%></center>
#</body>
#</html>
最后测试www.777.cn bbs.777.cn 通过。。