resin3.1配置说明

来源:互联网 发布:教材答案软件 编辑:程序博客网 时间:2024/05/12 12:31
  1. <!-- - Resin 3.1 配置文件. -->   
  2. <resin xmlns="http://caucho.com/ns/resin"      
  3.        xmlns:resin="http://caucho.com/ns/resin/core">   
  4.   
  5. <!-- 加载resin/lib下的所有.jar文件-->   
  6. <class-loader>   
  7.    <tree-loader path="${resin.home}/lib"/>   
  8.    <tree-loader path="${resin.root}/lib"/>   
  9. </class-loader>   
  10.   
  11. <!-- - 管理配置 -->   
  12. <management path="${resin.root}/admin">   
  13. </management>   
  14.   
  15. <!-- -JDK日志接口的配置. -->   
  16. <log name="" path="stdout:" timestamp="[%H:%M:%S.%s] "/>   
  17.   
  18. <!-- 日志信息的级别:'info' 生产环境 'fine' 开发环境 'finer' 调试环境 -->   
  19. <logger name="com.caucho" level="info"/>   
  20. <logger name="com.caucho.java" level="config"/>   
  21. <logger name="com.caucho.loader" level="config"/>   
  22.   
  23. <!-- - 环境上下文的检测时间,对于生产站点, 这个要设置长一点,例如600秒,10分钟 -->   
  24. <dependency-check-interval>2s</dependency-check-interval>   
  25.   
  26. <!-- - 发送邮件通知的SMTP服务器 -->   
  27. <system-property mail.smtp.host="127.0.0.1"/>   
  28. <system-property mail.smtp.port="25"/>   
  29.   
  30. <!-- - 你可以把编译器改成 "javac""eclipse" 或者 "internal". -->   
  31. <javac compiler="internal" args="-source 1.5"/>   
  32.   
  33. <!-- Security providers.   
  34.   - <security-provider>   
  35.   - com.sun.net.ssl.internal.ssl.Provider   
  36.   - </security-provider>   
  37.   -->   
  38.   
  39. <!-- 去掉注释,如果你使用resin提供的xml应用   
  40.   -   
  41.   - <system-property javax.xml.parsers.DocumentBuilderFactory   
  42.   - ="com.caucho.xml.parsers.XmlDocumentBuilderFactory"/>   
  43.   - <system-property javax.xml.parsers.SAXParserFactory   
  44.   - ="com.caucho.xml.parsers.XmlSAXParserFactory"/>   
  45.   -->   
  46.   
  47. <cluster id="app-tier">   
  48.     <!-- 设置集群上下文的根, 相对于server.root -->   
  49.     <root-directory>.</root-directory>   
  50.     <server-default>   
  51.         <!-- HTTP服务的端口-->   
  52.         <http address="*" port="8080"/>   
  53.         <!--   
  54.            - SSL端口配置:   
  55.            -   
  56.            - <http address="*" port="8443">   
  57.            - <openssl>   
  58.            - <certificate-file>keys/gryffindor.crt</certificate-file>   
  59.            - <certificate-key-file>keys/gryffindor.key</certificate-key-file>   
  60.            - <password>test123</password>   
  61.            - </openssl>   
  62.            - </http>   
  63.            -->   
  64.   
  65.         <!-- - JVM参数设置 -->   
  66.         <jvm-arg>-Xmx256m</jvm-arg>   
  67.         <jvm-arg>-Xss1m</jvm-arg>   
  68.         <jvm-arg>-Xdebug</jvm-arg>   
  69.         <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>   
  70.         <!-- Uncomment to enable admin heap dumps 去掉这个如果你想管理内存堆的倾倒   
  71.             - <jvm-arg>-agentlib:resin</jvm-arg>   
  72.           -->   
  73.         <watchdog-arg>-Dcom.sun.management.jmxremote</watchdog-arg>   
  74.   
  75.         <!-- 强制resin强制重起时的最小空闲内存 -->   
  76.         <memory-free-min>1M</memory-free-min>   
  77.         <!-- 最大线程数量. -->   
  78.         <thread-max>256</thread-max>   
  79.         <!-- 套接字等待时间 -->   
  80.         <socket-timeout>65s</socket-timeout>   
  81.         <!-- 配置 keepalive -->   
  82.         <keepalive-max>128</keepalive-max>   
  83.         <keepalive-timeout>15s</keepalive-timeout>   
  84.         <!-- - 如果使用的是UNIX,这里是启动的帐号和用户组.   
  85.           - <user-name>resin</user-name>   
  86.           - <group-name>resin</group-name>   
  87.           -->   
  88.     </server-default>   
  89.   
  90.     <!-- 定义群集服务器 -->   
  91.     <server id="" address="127.0.0.1" port="6800"/>   
  92.     <!-- Configures the persistent store for single-server or clustered 配置独立服务器或者群集的持久化存储,专业版的功能 -->   
  93.     <resin:if test="${resin.isProfessional()}">   
  94.        <persistent-store type="cluster">   
  95.            <init path="session"/>   
  96.        </persistent-store>   
  97.     </resin:if>   
  98.   
  99.     <!-- 为了安全, 你可以为SSL会话(SSL sessions)定义一个不同的cookie.   
  100.       - <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie>   
  101.       -->   
  102.   
  103.     <!-- 缓存启用 (专业版的功能) -->   
  104.     <resin:if test="${isResinProfessional}">   
  105.         <cache path="cache" memory-size="64M">   
  106.             <!-- Vary header rewriting for IE -->   
  107.             <rewrite-vary-as-private/>   
  108.         </cache>   
  109.     </resin:if>   
  110.   
  111.     <!-- 启用周期性的服务器状态检查和死锁检查,所有的服务器可以添加 <url> 来检查。 -->   
  112.     <resin:if test="${isResinProfessional}">   
  113.         <ping>   
  114.             <!-- <url>http://localhost:8080/test-ping.jsp</url> -->   
  115.         </ping>   
  116.     </resin:if>   
  117.   
  118.     <!-- 包含web应用的默认行为 -->   
  119.     <resin:import path="${resin.home}/conf/app-default.xml"/>   
  120.     <!-- 每一个web应用的默认参数 -->   
  121.     <web-app-default>   
  122.     <!-- 扩展库的公共jar文件,扩展是安全的即使没有类装载器知道的jars,装载的类将为每个应用分别装载,也就是这些类都是不同的-->   
  123.   
  124.         <class-loader>   
  125.             <tree-loader path="${server.root}/ext-webapp"/>   
  126.         </class-loader>   
  127.   
  128.         <!-- 设置缓存页、静态也的延时值 -->   
  129.         <cache-mapping url-pattern="/" expires="5s"/>   
  130.         <cache-mapping url-pattern="*.gif" expires="60s"/>   
  131.         <cache-mapping url-pattern="*.jpg" expires="60s"/>   
  132.         <cache-mapping url-pattern="*.png" expires="60s"/>   
  133.         <!-- 启用EL表达式 -->   
  134.         <allow-servlet-el/>   
  135.   
  136.         <!-- 安全原因, 默认禁用了会话的URLs -->   
  137.         <session-config>   
  138.             <enable-url-rewriting>false</enable-url-rewriting>   
  139.         </session-config>   
  140.   
  141.         <!-- 安全原因, 在cookies中设置HttpOnly标志   
  142.             - <cookie-http-only/>   
  143.           -->   
  144.   
  145.         <!--一些JSP包有不正确的 .tld文件。可以把validate-taglib-schema设置成false,可能继续正常工作   
  146.             - Some JSP packages have incorrect .tld files. It's possible to set validate-taglib-schema to false to work around these   
  147. packages.   
  148.           -->   
  149.   
  150.         <jsp>   
  151.             <validate-taglib-schema>true</validate-taglib-schema>   
  152.             <fast-jstl>true</fast-jstl>   
  153.             <fast-jsf>true</fast-jsf>   
  154.         </jsp>   
  155.      </web-app-default>   
  156.   
  157.      <!-- 简单的数据池配置   
  158.         - The JDBC name is java:comp/env/jdbc/test   
  159.        <database>   
  160.           <jndi-name>jdbc/mysql</jndi-name>   
  161.           <driver type="org.gjt.mm.mysql.Driver">   
  162.               <url>jdbc:mysql://localhost:3306/test</url>   
  163.               <user></user>   
  164.               <password></password>   
  165.           </driver>   
  166.           <prepared-statement-cache-size>8</prepared-statement-cache-size>   
  167.           <max-connections>20</max-connections>   
  168.           <max-idle-time>30s</max-idle-time>   
  169.         </database>   
  170.         -->   
  171.   
  172.      <!-- 定义所有虚拟主机的默认配置 -->   
  173.      <host-default>   
  174.          <!-- 如果和别的web服务器整合,这个可以被去掉,因为web服务器也可以记录这些信息。 -->   
  175.          <access-log path="logs/access.log" format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"' rollover-period="1W"/>   
  176.   
  177.          <!-- war 文件的布置目录 -->   
  178.          <web-app-deploy path="webapps"/>   
  179.   
  180.          <!-- ear文件的布置目录 -->   
  181.          <ear-deploy path="deploy">   
  182.             <ear-default>   
  183.                 <ejb-server>   
  184.                    <config-directory>WEB-INF</config-directory>   
  185.                    <data-source>jdbc/test</data-source>   
  186.                 </ejb-server>   
  187.             </ear-default>   
  188.          </ear-deploy>   
  189.   
  190.          <!-- rar文件的布置目录 -->   
  191.          <resource-deploy path="deploy"/>   
  192.      </host-default>   
  193.   
  194.   
  195.      <!-- 虚拟主机的布置目录 -->   
  196.      <host-deploy path="hosts">   
  197.           <host-default>   
  198.                <resin:import path="host.xml" optional="true"/>   
  199.           </host-default>   
  200.      </host-deploy>   
  201.   
  202.      <!-- 默认的虚拟主机配置 -->   
  203.      <host id="" root-directory=".">   
  204.           <!-- 配置默认的应用 webapp's ROOT -->   
  205.           <web-app id="/" root-directory="webapps/ROOT"/>   
  206.           <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">   
  207.                <!-- - 管理应用程序 /resin-admin   
  208.                  - password is the md5 hash of the password。md5码的密码。   
  209.                    - localhost is true to limit access to the localhost。localhost设置成true,这样只有localhost才能访问   
  210.                    -->   
  211.                <prologue>   
  212.                     <resin:set var="resin_admin_user" value=""/>   
  213.                     <resin:set var="resin_admin_password" value=""/>   
  214.                     <resin:set var="resin_admin_external" value="false"/>   
  215.                </prologue>   
  216.           </web-app>   
  217.      </host>   
  218.   
  219. </cluster>   
  220.   
  221.   
  222. <!-- - Configuration for the web-tier/load-balancer -->   
  223. <resin:if test="${resin.isProfessional()}">   
  224.      <cluster id="web-tier">   
  225.           <server-default>   
  226.                <!-- The http port -->   
  227.                <http address="*" port="9080"/>   
  228.           </server-default>   
  229.           <server id="web-a" address="127.0.0.1" port="6700"/>   
  230.           <cache path="cache" memory-size="64M"/>   
  231.           <host id="">   
  232.                <web-app id="/">   
  233.                     <rewrite-dispatch>   
  234.                          <load-balance regexp="" cluster="app-tier"/>   
  235.                     </rewrite-dispatch>   
  236.                </web-app>   
  237.           </host>   
  238.      </cluster>   
  239. </resin:if>   
  240.   
  241. </resin>