DBMNG数据库管理与应用

独立思考能力,对于从事科学研究或其他任何工作,都是十分必要的。
当前位置:首页 > 服务器配置 > Resin

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

可能是因为resin4出来不久的原因,很多人对一个resin配置多个app不是很了解,经过几个小时的研究,有了一些小的成果,在此分享一下:

在开发的时候很多人习惯了一个resin下配置多个app,习惯了resin3的配置方式,所以resin4出来后就不懂如何配置了。

根据我的理解,配置多个app分为两种情况(此处指一个resin的情况下):

一.同一个域名下多个子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">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </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>


第二种的配置方法: 
<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">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!--每个host id下也可以包含多个web-app,参考第一种的配置方法-->
    <host id="www.test1.com" root-directory=".">
      <web-app id="/" root-directory="webapps/test1/ROOT"/>
    </host>

    <host id="www.test2.com" root-directory=".">
      <web-app id="/" root-directory="webapps/test2/ROOT"/>
    </host>

 </cluster>
本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号