zoukankan      html  css  js  c++  java
  • Gzip Expires resin

    web开发中可以通过gzip压缩页面来降低网站的流量,而gzip并不会对cpu造成大量的占用. resin中配置Gzip只需要在resin配置文件中加入一个filter即可,以下测试在resin-4.0.23非专业版上进行

    1.在resin.xml中<web-app ...>下增加

    <web-app xmlns="http://caucho.com/ns/resin">
      <filter filter-name="gzip" filter-class="com.caucho.filters.GzipFilter">
       <init>
         <use-vary>true</use-vary>
       </init>
      </filter>
    
      <filter-mapping filter-name="gzip">
        <url-pattern>
          <exclude-pattern>*.png</exclude-pattern>
          <include-pattern>/*</include-pattern>
        </url-pattern>
      </filter-mapping>
    </web-app>
    *有些文章说此方法只对于专业版本的resin有效,但经测试非专业版也适用

     参考:

    http://waynewan.com/archives/61

    Expires header

    <resin xmlns="http://caucho.com/ns/resin">
      <logger name="com.caucho.server.cache" level="fine"/>       #Debugging caching
      ...
      <host id="" root-directory="D:\works\deploy\mobile">
          <web-app id="/" root-directory=".">
            <session-config>
              <reuse-session-id>true</reuse-session-id>
              <enable-cookies>false</enable-cookies>
              <enable-url-rewriting>true</enable-url-rewriting> 
            </session-config>
            <cache-mapping url-pattern="*.gif" max-age="24h"/>
            <cache-mapping url-pattern="*.jpg" max-age="24h"/>
            <cache-mapping url-pattern="*.png" max-age="24h"/>
            <cache-mapping url-pattern="*.css" max-age="1h"/>
            <filter filter-name="gzip" filter-class="com.caucho.filters.GzipFilter">
              <init>
                <use-vary>true</use-vary>
              </init>
            </filter>
            <filter-mapping filter-name="gzip">
              <url-pattern>
                <exclude-pattern>*.png,*.jpg,*.ico,*.gif,*.css</exclude-pattern>
                <include-pattern>/*</include-pattern>
              </url-pattern>
            </filter-mapping>
          </web-app>
      </host>
    

     参考:

    http://caucho.com/resin-4.0/admin/http-proxy-cache.xtp#Expires

  • 相关阅读:
    使用IIS实现反向代理
    C#管理windows服务
    使用SoapUI测试windows身份验证的webservice
    SQLSERVER2014集群实战——IP引发的坑
    (复活公告??)
    各种trick和细节错误汇总
    emacs常用指令
    随机数据生成与对拍【c++版,良心讲解】
    UVA11019 Matrix Matcher
    HDU4757 Tree
  • 原文地址:https://www.cnblogs.com/wen12128/p/2660035.html
Copyright © 2011-2022 走看看