resin安装与配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了resin安装与配置相关的知识,希望对你有一定的参考价值。

resin安装与配置

介绍下第二种支持java的软件resin

官网地址:caucho.com

有两个版本,一个免费的一个收费的

具体步骤如下:

一、下载和配置jdk

(1)下载JDK(百度搜JDK官网)

http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

下载步骤截图如下:

技术分享

技术分享

(2)解压JDK安装包

[[email protected] ~]# cd /usr/local/src

[[email protected] src]# ls

jdk-8u131-linux-i586.gz

[[email protected] src]# tar -zxvf jdk-8u131-linux-i586.gz

[[email protected] src]# ls

jdk1.8.0_131  jdk-8u131-linux-i586.gz

(3)移动jdk1.8.0_131

[[email protected] src]# mv jdk1.8.0_131  /usr/local/

[[email protected] src]# cd ..

[[email protected] local]# ls

bin  etc  games  include  jdk1.8.0_131  lib  libexec  sbin  share  src

(4)做全局环境变量

[[email protected] local]# vim /etc/profile.d/java.sh

插入:

JAVA_HOME=/usr/local/jdk1.8.0_131/

JAVA_BIN=/usr/local/jdk1.8.0_131/bin

JRE_HOME=/usr/local/jdk1.8.0_131/jre

PATH=$PATH:/usr/local/jdk1.8.0_131/bin:/usr/local/jdk1.8.0_131/jre/bin

CLASSPATH=/usr/local/jdk1.8.0_131/jre/lib:/usr/local/jdk1.8.0_131/lib:/usr/local/jdk1.8.0_131/jre/lib/charsets.jar

(5)保存并使其生效

[[email protected] src]# source /etc/profile.d/java.sh

(6)查看java版本

[[email protected] src]# java -version

java version "1.8.0_131"

Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)

二、下载和配置resin

(1)下载resin

[[email protected] ~]# cd /usr/local/src

[[email protected] src]#  wget http://caucho.com/download/resin-4.0.51.tar.gz

[[email protected] src]# ls

jdk-8u131-linux-i586.gz  resin-4.0.51.tar.gz

(2)解压

[[email protected] src]# tar -zxvf resin-4.0.51.tar.gz

[[email protected] src]# ll

total 210408

-rw-r--r--  1 root root 188105480 Apr 25 05:18 jdk-8u131-linux-i586.gz

drwxr-xr-x 20 root root      4096 Apr 25 05:30 resin-4.0.51

-rw-r--r--  1 root root  27343255 Mar  2 12:00 resin-4.0.51.tar.gz

(3)编译安装

这是和tomcat不同的地方,resin需要编译

在编译之前先安装gcc,命令:yum intall -y gcc

[[email protected] resin-4.0.51]# ./configure --prefix=/usr/local/resin --with-java=/usr/local/jdk1.8.0_131/

[[email protected] resin-4.0.51]# echo $?

0

[[email protected] resin-4.0.51]# make ##如果这一步报错,请安装gcc,命令:yum intall -y gcc

[[email protected] resin-4.0.51]# echo $?

0

[[email protected] resin-4.0.51]# make install

[[email protected] resin-4.0.51]# echo $?

0

(4)查看生成的resin目录

[[email protected] resin-4.0.51]# ls /usr/local/resin/

app-inf  conf  endorsed  libexec  project-jars  webapp-jars

bin      doc   lib       log      resin-inf     webapps

(5)查看自动生成的启动目录

[[email protected] resin-4.0.51]# ll /etc/init.d/resin

-rwxr-xr-x 1 root root 3249 Apr 25 05:55 /etc/init.d/resin

(6)启动resin

注意:再启动resin之前最好将tomcat关闭,因为都是启用的java进程

[[email protected] resin-4.0.51]# /etc/init.d/tomcat stop

[[email protected] resin-4.0.51]# /etc/init.d/resin start

注:resin在这里跟tomcat不同的地方是它支持restart,而tomcat不支持!

(7)查看resin进程

[[email protected] resin-4.0.51]# ps aux |grep resin

(8)查看resin监听端口

[[email protected] resin-4.0.51]# netstat -lnp

# 监听端口:6600 6800 8080

(9)用浏览器访问http://192.168.100.111:8080/测试


三、优化配置resin

(1)编辑resin配置文件(更改域名或者端口)

[[email protected] resin-4.0.51]# cd /usr/local/resin/

[[email protected] resin]# ls

app-inf  conf  endorsed  libexec  project-jars  resin-inf      webapp-jars

bin      doc   lib       log      resin-data    watchdog-data  webapps

[[email protected] resin]# cd conf

[[email protected] conf]# ls

app-default.xml      health.xml  licenses          resin.xml

cluster-default.xml  keys        resin.properties

[[email protected] conf]# vim resin.properties

找到app.http : 8080 改为 app.http : 80

技术分享

注:要先停止nginx,之前80端口是nginx占用的。

[[email protected] conf]# /etc/init.d/resin restart

浏览器再次访问http://192.168.100.111/ 不加端口号成功,证明80端口能够访问.

(2)更改域名配置文件

[[email protected] conf]# vim resin.xml

先找到:

技术分享

再在id="app"内部找到:

技术分享

在</host>与<resin:if tst="${resin_doc}">中间插入如下内容:

<host id="www.123.com" root-directory=".">

<web-app id="/" root-directory="/tmp/resin"/>

</host>

截图如下:

技术分享

[[email protected] conf]# mkdir /tmp/resin

[[email protected] conf]# /etc/init.d/resin restart

[[email protected] conf]# ls /tmp/resin/

WEB-INF

注:先创建目录,后重启resin程序,会在目录下自动生成WEB-INF文件

(3)测试jsp解析

[[email protected] conf]#vim /tmp/resin/123.jsp

写入:

<html><body><center>

    Now time is: <%=new java.util.Date()%>

</center></body></html>

保存!

[[email protected] conf]# curl -x127.0.0.1:8080 www.123.com/123.jsp

或[[email protected] conf]# curl -x192.168.100.111:8080 www.123.com/123.jsp

结果如下:

[[email protected] resin]# date

Tue Apr 25 10:22:59 CST 2017

[[email protected] resin]# curl -x192.168.100.111:8080 www.123.com/123.jsp


<html><body><center>

    Now time is: Tue Apr 25 10:23:04 CST 2017

</center></body></html>

[[email protected] resin]# curl -x127.0.0.1:8080 www.123.com/123.jsp


<html><body><center>

    Now time is: Tue Apr 25 10:23:19 CST 2017

</center></body></html>


本文出自 “圣骑士控魔之手” 博客,请务必保留此出处http://wutengfei.blog.51cto.com/10942117/1927778

以上是关于resin安装与配置的主要内容,如果未能解决你的问题,请参考以下文章

resin安装与配置

resin安装与配置

resin 安装 配置 优化 整合apache

resin安装与配置

resin安装配置

resin 安装配置