Jun 09, 2009

Apache Tomcat で gzip 圧縮を有効にする方法

Apache Tomcat で gzip 圧縮を有効にする方法をメモ。

Apache Tomcat Configuration Reference - The HTTP Connector
http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
compression
The Connector may use HTTP/1.1 GZIP compression in an attempt to save server bandwidth. The acceptable values for the parameter is "off" (disable compression), "on" (allow compression, which causes text data to be compressed), "force" (forces compression in all cases), or a numerical integer value (which is equivalent to "on", but specifies the minimum amount of data before the output is compressed). If the content-length is not known and compression is set to "on" or more aggressive, the output will also be compressed. If not specified, this attribute is set to "off".
$CATALINA_HOME/conf/server.xml を以下の様に設定する。
<Server port="8005" shutdown="SHUTDOWN">
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" 
               useBodyEncodingForURI="true" 
               compression="on"/>
</Server>

TrackBack ping me at
http://www.in-vitro.jp/blog/index.cgi/AS/20090609_01.trackback
Post a comment

writeback message: Ready to post a comment.