码迷,mamicode.com
首页 > Web开发 > 详细

解析jsp的 tomcat 、resin

时间:2016-04-16 18:38:53      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

一、tomcat

 1. 安装JDK

[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://www.lishiming.net/data/attachment/forum/jdk-6u23-linux-i586.bin
[root@localhost src]# chmod a+x jdk-6u23-linux-i586.bin
[root@localhost src]# ./jdk-6u23-linux-i586.bin   //解压文件
Press Enter to continue.....      //按一下回车即可
[root@localhost src]# mv  jdk1.6.0_23  /usr/local/
[root@localhost src]# vim /etc/profile
//文件最尾部加入
JAVA_HOME=/usr/local/jdk1.6.0_23/
JAVA_BIN=/usr/local/jdk1.6.0_23/bin
JRE_HOME=/usr/local/jdk1.6.0_23/jre
PATH=$PATH:/usr/local/jdk1.6.0_23/bin:/usr/local/jdk1.6.0_23/jre/bin
CLASSPATH=/usr/local/jdk1.6.0_23/jre/lib:/usr/local/jdk1.6.0_23/lib:/usr/local/jdk1.6.0_23/jre/lib/charsets.jar
export  JAVA_HOME  JAVA_BIN JRE_HOME  PATH  CLASSPATH

[root@localhost src]# source /etc/profile 
[root@localhost src]# java -version 
//如果显示如下内容,则配置正确:
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)

 

 2.安装tomcat

[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget http://www.lishiming.net/data/attachment/forum/apache-tomcat-7.0.14.tar.gz
[root@localhost src]# tar zxvf apache-tomcat-7.0.14.tar.gz
[root@localhost src]# mv apache-tomcat-7.0.14 /usr/local/tomcat
[root@localhost src]# cp -p /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
[root@localhost src]# vim /etc/init.d/tomcat
//在第二行加入以下的内容
...
# chkconfig: 112 63 37
# description: tomcat server init script
# Source Function Library
. /etc/init.d/functions

JAVA_HOME=/usr/local/jdk1.6.0_23/
CATALINA_HOME=/usr/local/tomcat
...
[root@localhost src]# chmod 755 /etc/init.d/tomcat
[root@localhost src]# chkconfig --add tomcat
[root@localhost src]# chkconfig tomcat on
[root@localhost src]# service tomcat start
[root@localhost src]# ps aux |grep tomcat

 

 3.配置tomcat

1. 配置tomcat服务的访问端口
[root@localhost ~]# vim /usr/local/tomcat/conf/server.xml
...
<Connector port="8080" protocol="HTTP/1.1"
/*tomcat默认启动的是8080,也可以修改为80
<Connector port="80" protocol="HTTP/1.1"  */


2. 配置新的虚拟主机
[root@localhost ~]# vim /usr/local/tomcat/conf/server.xml
//找到</Host>,在下一行插入
<Host name="www.123.cn" appBase="/data/tomcatweb"
    unpackWARs="false" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="./" debug="0" reloadable="true" crossContext="true"/>
</Host>
[root@localhost ~]# service tomcat stop
[root@localhost ~]# service tomcat start

 

 4.测试tomcat

[root@localhost ~]# mkdir -p /data/tomcatweb
[root@localhost ~]# vim 111.jsp
//加入
<html><body><center>
    Now time is: <%=new java.util.Date()%>
</center></body></html>
[root@localhost ~]# curl -xlocalhost:80 www.123.cn/111.jsp
//此时要注意是否有之前有改变tomcat的端口,没有改变则要写成localhost:8080

//是否运行结果是
<html><body><center>
    Now time is: Thu Jun 13 15:26:03 CST 2013
</center></body></html>

/*tomcat搭建成功*/

/*真机上,绑定hosts, 用IE来测试它。*/

 

二、resin

 1. 安装JDK

可以安装以上tomcat的方法进行配置

 

 

2.安装resin

[root@localhost ~]# wget  http://www.caucho.com/download/resin-4.0.36.tar.gz
[root@localhost ~]# tar zxvf resin-4.0.36.tar.gz
[root@localhost ~]# cd resin-4.0.36
[root@localhost resin-4.0.36]# ./configure --prefix=/usr/local/resin   --with-java-home=/usr/local/jdk1.8.0_31
[root@localhost resin-4.0.36]# make && make install
[root@localhost resin-4.0.36]# /etc/init.d/resin start

 

3.配置resin

[root@localhost ~]# vim /usr/local/resin/conf/resin.xml
//找到<cluster id="app">,在此下的<host>与</host></cluster>之间添加
 <host id="www.123.com" root-directory=".">
    <web-app id="/" root-directory="/tmp/123"/>
    </host>

[root@localhost ~]# mkdir /tmp/123
[root@localhost ~]# vim /tmp/123/test.jsp
//加入
<html><body><center> 
Now time is: <%=new java.util.Date()%> 
</center></body></html> 

//测试
[root@localhost ~]# curl -xlocalhost:8080 www.123.com/test.jsp

 

解析jsp的 tomcat 、resin

标签:

原文地址:http://www.cnblogs.com/frankielf0921/p/5398334.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!