tomcat6.0 啓用Gzip壓縮

項目中用的服務器是tomcat6.0 需要做一下Gzip壓縮,但配置文件中並沒有關於 Gzip的代碼,這並不說明 tomcat6.0 不支持Gzip壓縮

只需要在server.xml文件中引入項目的地方加上如下標紅內容

<Service name="www.yitire.com">
    <Connector port="5003" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="true" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="utf-8"
                  compression="on"
                  compressionMinSize="2048"
                  noCompressionUserAgents="gozilla, traviata"
                  compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain"
  />

便可達到壓縮目的

在線檢測是否壓縮:http://gzip.zzbaike.com/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章