1. 程式人生 > >Resin 3.1配置檔案詳解

Resin 3.1配置檔案詳解

                          Resin 3.1配置檔案詳解 

 

轉載:http://blog.sina.com.cn/s/blog_9fd5b6df01010net.html

<!-- Resin 3.1 configuration file. (Resin 3.1 配置檔案)-->
 
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="

http://caucho.com/ns/resin/core">
 
  <!-- adds all .jar files under the resin/lib directory (載入 resin/lib 下的所有.jar檔案) -->
  <class-loader>
    <tree-loader path="${resin.home}/ext-lib"/>
    <tree-loader path="${resin.root}/ext-lib"/>
    <tree-loader path="${resin.home}/lib"/>
    <tree-loader path="${resin.root}/lib"/>
  </class-loader>
<span id="more-321"></span>
  <!--Management configuration Remote management requires at least one enabled admin user.(管理配置,需要一個管理員使用者)-->
  <management path="${resin.root}/admin">
    <user name="admin" password="password" disable="true"/>
    <resin:if test="${resin.professional}">
      <deploy-service/>
      <jmx-service/>
      <log-service/>
      <xa-log-service/>
    </resin:if>
  </management>
 
  <!--Logging configuration for the JDK logging API.(JDK日誌配置)-->
  <log name="" level="info" path="stdout:"
       timestamp="[%H:%M:%S.%s] {%{thread}} "/>
 
  <!-- 'info' for production 'fine' or 'finer' for development and troubleshooting (日誌資訊級別:info生產環境 fine和finer適合開發環境和除錯環境)-->
  <logger name="com.caucho" level="info"/>
  <logger name="com.caucho.java" level="config"/>
  <logger name="com.caucho.loader" level="config"/>
 
  <!--For production sites, change dependency-check-interval to something like 600s, so it only checks for updates every 10 minutes.(環境依賴檢查時間,生產系統設定長點,600s 10分鐘)-->
  <dependency-check-interval>2s</dependency-check-interval>
 
  <!-- SMTP server for sending mail notifications (SMTP伺服器配置)-->
  <system-property mail.smtp.host="127.0.0.1"/>
  <system-property mail.smtp.port="25"/>
 
  <!-- Sets the default character encoding to utf-8 <character-encoding>utf-8</character-encoding> (預設字符集為 utf-8 ) -->
 
  <!-- You can change the compiler to "javac", "eclipse" or "internal".(你可以把編譯器改成 javac、eclipse 或 internal)-->
  <javac compiler="internal" args="-source 1.5"/>
 
  <!-- Security providers. <security-provider> com.sun.net.ssl.internal.ssl.Provider </security-provider> (SSL 安全)-->
 
  <!-- Uncomment to use Resin's XML implementations
     - <system-property javax.xml.parsers.DocumentBuilderFactory
     -                 ="com.caucho.xml.parsers.XmlDocumentBuilderFactory"/>
     - <system-property javax.xml.parsers.SAXParserFactory
     -                 ="com.caucho.xml.parsers.XmlSAXParserFactory"/>
    (去掉注視,可以使用resin提供的xml應用)
     -->
 
  <cluster id="app-tier">
    <!-- sets the content root for the cluster, relative to server.root  (設定叢集的根目錄)-->
    <root-directory>.</root-directory>
 
    <server-default>
      <!-- The http port (http服務的埠)-->
      <http address="*" port="8080"/>
 
      <!-- SSL port configuration:
         - <http address="*" port="8443">
         -   <openssl>
         -     <certificate-file>keys/gryffindor.crt</certificate-file>
         -     <certificate-key-file>keys/gryffindor.key</certificate-key-file>
         -     <password>test123</password>
         -   </openssl>
         - </http>  (SSL配置)
        -->
 
      <!-- The JVM arguments (JVM引數設定)-->
      <jvm-arg>-Xmx256m</jvm-arg>
      <jvm-arg>-Xss1m</jvm-arg>
      <jvm-arg>-Xdebug</jvm-arg>
      <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
 
      <!-- Uncomment to enable admin heap dumps  (去掉註釋 你可以自己管理記憶體堆)
 - <jvm-arg>-agentlib:resin</jvm-arg> -->
 
      <!-- arguments for the watchdog process (配置watchdog)-->
      <watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
      <watchdog-port>6600</watchdog-port>
 
      <!-- Configures the minimum free memory allowed before Resin will force a restart.(配置resin強制重啟時的最小空閒記憶體)-->
      <memory-free-min>1M</memory-free-min>
 
      <!-- Maximum number of threads.(最大執行緒數量) -->
      <thread-max>256</thread-max>
 
      <!-- Configures the socket timeout (套接字超時時間) -->
      <socket-timeout>65s</socket-timeout>
 
      <!-- Configures the keepalive (keepalive 的最大連結數和keepalive的超時時間)-->
      <keepalive-max>128</keepalive-max>
      <keepalive-timeout>15s</keepalive-timeout>
 
      <!--
         - If starting bin/resin as root on Unix, specify the user name
         - and group name for the web server user.(使用unix系統時 啟動resin的使用者和組)
         - <user-name>resin</user-name>
         - <group-name>resin</group-name>
        -->
 
    </server-default>
 
    <!-- define the servers in the cluster  (定義叢集伺服器)-->
    <server id="" address="127.0.0.1" port="6800"/>
 
    <!-- Configures the persistent store for single-server or clustered in Resin professional.(配置獨立或叢集的持久化儲存,專業版功能) -->
    <resin:if test="${resin.professional}">
      <persistent-store type="cluster">
        <init path="session"/>
      </persistent-store>
    </resin:if>
 
    <!-- For security, use a different cookie for SSL sessions.(為了安全 你可以為SSL會話定義一個不同的cookie)
       - <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie>
      -->
 
    <!-- Enables the cache (available in Resin Professional) (快取功能啟用, Professional功能)-->
    <resin:if test="${resin.professional}">
      <cache path="cache" memory-size="64M">
        <!-- Vary header rewriting for IE -->
        <rewrite-vary-as-private/>
      </cache>
    </resin:if>
 
    <!-- Enables periodic checking of the server status and check for deadlocks.. All servers can add <url>s to be checked. (可以定期檢查伺服器的狀態和死鎖檢查..所有伺服器都可以新增的<url> s的檢查  Professional功能 )-->
    <resin:if test="${resin.professional}">
      <ping>
        <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
      </ping>
    </resin:if>
 
    <!-- Defaults applied to each web-app.(預設web程式)-->
    <web-app-default>
      <prologue>
        <!-- Extension library for common jar files.  The ext is safe
           - even for non-classloader aware jars.  The loaded classes
           - will be loaded separately for each web-app, i.e. the class
           - itself will be distinct. (擴充套件庫的公共jar檔案,擴充套件是安全的即使沒有類裝載器知道的jars,裝載的類將為每個應用分別裝載,也就是這些類都是不同的)
           -->
        <class-loader>
          <tree-loader path="${resin.root}/ext-webapp-lib"/>
        </class-loader>
 
        <!-- Enable EL expressions in Servlet and Filter init-param ()-->
        <allow-servlet-el/>
      </prologue>
 
      <!-- Sets timeout values for cacheable pages, e.g. static pages (設定快取、靜態頁面的數值。)-->
      <cache-mapping url-pattern="/" expires="5s"/>
      <cache-mapping url-pattern="*.gif" expires="60s"/>
      <cache-mapping url-pattern="*.jpg" expires="60s"/>
      <cache-mapping url-pattern="*.png" expires="60s"/>
 
      <!-- for security, disable session URLs by default. (安全的原因,預設禁用了會話的URL) -->
      <session-config>
        <enable-url-rewriting>false</enable-url-rewriting>
      </session-config>
 
      <!-- For security, set the HttpOnly flag in cookies.(安全原因,在cokkies中設定 HttpOnly標記 防止跨站攻擊)
         - <cookie-http-only/>
        -->
 
      <!-- Some JSP packages have incorrect .tld files.  It's possible to set validate-taglib-schema to false to work around these packages. (一些JSP包有不正確的。TLD檔案。它可以設定validate-taglib-schema為false來變通解決這些包。使其可以正常工作) -->
        <jsp>
          <validate-taglib-schema>true</validate-taglib-schema>
          <fast-jstl>true</fast-jstl>
        </jsp>
    </web-app-default>
 
    <!-- includes the app-default for default web-app behavior (匯入用於預設網路應用程式的行為違約) -->
    <resin:import path="${resin.home}/conf/app-default.xml"/>
 
    <!-- Sample database pool configuration The JDBC name is java:comp/env/jdbc/test (簡單的資料池配置)
         <database>
           <jndi-name>jdbc/mysql</jndi-name>
           <driver type="org.gjt.mm.mysql.Driver">
             <url>jdbc:mysql://localhost:3306/test</url>
             <user></user>
             <password></password>
            </driver>
            <prepared-statement-cache-size>8</prepared-statement-cache-size>
            <max-connections>20</max-connections>
            <max-idle-time>30s</max-idle-time>
          </database>
      -->
 
    <!-- Default host configuration applied to all virtual hosts.(定義所有虛擬主機的預設配置) -->
    <host-default>
      <!-- With another web server, like Apache, this can be commented out because the web server will log this information.(如果和別的 web伺服器整合,這個可以被去掉,因為web伺服器也可以記錄這些資訊)-->
      <access-log path="logs/access.log"
            format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
            rollover-period="1W"/>
 
      <!-- creates the webapps directory for .war expansion  (.war檔案的目錄)-->
      <web-app-deploy path="webapps"/>
 
      <!-- creates the deploy directory for .ear expansion (.ear檔案的目錄)-->
      <ear-deploy path="deploy">
        <ear-default>
          <ejb-server>
            <config-directory>WEB-INF</config-directory>
          </ejb-server>
        </ear-default>
      </ear-deploy>
 
      <!-- creates the deploy directory for .rar expansion (.rar檔案目錄)-->
      <resource-deploy path="deploy"/>
    </host-default>
 
    <!-- configures a deployment directory for virtual hosts (虛擬主機的目錄)-->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>
 
    <!-- configures the default host, matching any host name (預設虛擬主機配置)-->
    <host id="" root-directory=".">
      <!-- configures an explicit root web-app matching the webapp's ROOT (預設的虛擬主機配置) -->
      <web-app id="/" root-directory="webapps/ROOT"/>
      <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
        <!-- Administration application /resin-admin (管理應用程式 /resin-admin) -->
        <prologue>
          <resin:set var="resin_admin_external" value="false"/>
          <resin:set var="resin_admin_insecure" value="true"/>
        </prologue>
      </web-app>
    </host>
  </cluster>
 
  <!-- Configuration for the web-tier/load-balancer (配置為Web層/負載平衡器)-->
  <resin:if test="${resin.professional}">
    <cluster id="web-tier">
      <server-default>
        <!-- The http port -->
        <http address="*" port="9080"/>
      </server-default>
      <server id="web-a" address="127.0.0.1" port="6700"/>
      <cache path="cache" memory-size="64M"/>
      <host id="">
        <web-app id="/">
 
           <rewrite-dispatch>
             <load-balance regexp="" cluster="app-tier"/>
           </rewrite-dispatch>
 
        </web-app>
      </host>
    </cluster>
  </resin:if>
</resin>