天天看點

Linux Resin 4安裝配置

Resin,是一個非常流行的application server,對servlet和JSP提供了良好的支援,性能優良,resin自身采用Java語言開發。Resin Pro版本支援緩存和負載均衡。

1, Resin 下載下傳

Resin 官方下載下傳網址, 最新版下載下傳 resin-4.0.36.tar.gz(免費版)

resin 安裝需要提前配置好jdk,下載下傳最新版 JDK7

(1)Linux環境配置JDK環境變量:

JAVA_HOME=/usr/local/jdk1.6.0_32

CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib

PATH=$PATH:$JAVA_HOME/bin

export PATH JAVA_HOME CLASSPATH

測試java環境:

[root@test2 conf]# java -version

java version "1.5.0"

gij (GNU libgcj) version 4.4.4 20100726 (Red Hat 4.4.4-13)

Copyright (C) 2007 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2, Resin 安裝

(1) 解壓tar.gz

tar zxvf resin-4.0.36.tar.gz

cd resin-4.0.36

(2) 安裝resin

./configure --prefix=/usr/local/resin-4.0.36 --with-java-home=/usr/local/jdk1.6.0_32 --enable-64bit

make

make install

3, Resin 驗證

啟動 resin: ./bin/resin.sh start

開機自啟動: vi /etc/rc.local 添加下行指令:

/usr/local/resin-4.0.36/bin/resin.sh start

[root@test2 bin]# ./resin.sh start

Resin/4.0.36 launching watchdog at 127.0.0.1:6600

Resin/4.0.36 started -server 'app-0' with watchdog at 127.0.0.1:6600

表示 啟動成功

在浏覽器裡輸入: http://localhost:8080/

Linux Resin 4安裝配置

點選resin-admin, 報錯403拒絕

Linux Resin 4安裝配置

因為我用浏覽器遠端通路的,此時需要修改/usr/local/resin-4.0.36/conf 目錄下的 resin.properties 檔案,去掉

web_admin_external : true 前面的 ‘#’,就可以了

Linux Resin 4安裝配置

出現以上頁面就好了,此時需要注冊管理者賬号

注冊後,預設生成了/usr/local/resin-4.0.36/conf/admin-users.xml.generated

Linux Resin 4安裝配置

注冊送出後,出現以上頁面,

進入其目錄,把檔案admin-users.xml.generated修改為admin-users.xml,可以看到遠端通路進行的操作

然後以管理者賬号登陸,出現以上監控頁面

注: 如果部署到無GUI界面的系統上(如 Ubuntu-server、 CentOS、Solaris等),無法通過浏覽器通路本地 resin-admin,則需要修改 resin.properties ,開啟遠端通路權限:

Linux Resin 4安裝配置

4, 部署 web

(1)拷貝自己的項目例如:MyPro,到/usr/local/resin-4.0.36/webapps/目錄下

(2) 修改resiin配置檔案: vi conf/resin.xml

在節點“host id”下,添加一行“web-app”,指向自己的項目(MyPro),id為項目的虛拟目錄,例如:api

Linux Resin 4安裝配置

驗證方法,在浏覽器裡輸入: http://localhost:8080/api

resin4配置之一個resin下多個app的正确配置方法

一.同一個域名下多個子app,根據url層級來指向,例如:

http://www.test.com與http://www.test.com/demo/

二.多個域名對應指定的host,根據域名來指向,例如:

http://www.test1.com與http://www.test2.com

第一種的配置方法:

<cluster id="app">

<!-- define the servers in the cluster -->

<server-multi id-prefix="app-" address-list="${app_servers}" port="6801"/>

<host-default>

<!-- creates the webapps directory for .war expansion -->

<web-app-deploy path="webapps"

expand-preserve-fileset="WEB-INF/work/**"

multiversion-routing="${webapp_multiversion_routing}"

path-suffix="${elastic_webapp?resin.id:''}"/>

</host-default>

<!-- auto virtual host deployment in hosts/foo.example.com/webapps -->

<host-deploy path="hosts">

<resin:import path="host.xml" optional="true"/>

</host-deploy>

<!-- the default host, matching any host name -->

<host id="" root-directory=".">

<!--

- webapps can be overridden/extended in the resin.xml

-->

<web-app id="/" root-directory="webapps/ROOT"/>

<web-app id="/demo" root-directory="webapps/demo"/>

</host>

</cluster>

第二種的配置方法:

<!--每個host id下也可以包含多個web-app,參考第一種的配置方法-->

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

<web-app id="/" root-directory="webapps/test1/ROOT"/>

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

<web-app id="/" root-directory="webapps/test2/ROOT"/>

繼續閱讀