- 2008 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2007 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2006 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2005 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2004 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2003 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2002 : 01 02 03 04 05 06 07 08 09 10 11 12
2006-02-21
Apache2 で mod_deflate
- Summary
ネットワークの速度がボトルネックになっている場合には,
動的にコンテンツ圧縮を行うことでパフォーマンスを上げることが可能.
動的に圧縮を行うため,CPU等のリソースは通常の転送時以上に消費する.
Apache1.x では mod_gzip を用いたが,Apache2.x では mod_deflate を用いる.
- /etc/apache2/mods-available/deflate.conf を作成
- /etc/apache/sites-enable/defalut
- mod_deflate を有効化
ネットワークの速度がボトルネックになっている場合には,
動的にコンテンツ圧縮を行うことでパフォーマンスを上げることが可能.
動的に圧縮を行うため,CPU等のリソースは通常の転送時以上に消費する.
Apache1.x では mod_gzip を用いたが,Apache2.x では mod_deflate を用いる.
- /etc/apache2/mods-available/deflate.conf を作成
# mod_deflate <IfModule mod_deflate.c> AddEncoding x-compress Z AddEncoding x-gzip gz tgz DeflateCompressionLevel 9 #AddOutputFilterByType DEFLATE text/html text/plain text/xml DeflateFilterNote Input instream DeflateFilterNote Output outstream DeflateFilterNote Ratio ratio LogFormat '%h %l %u %t "%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate <Directory /> # Filter SetOutputFilter DEFLATE # Netscape 4.x BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images and binary files SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar|7z)$ no-gzip dont-vary </Directory> </IfModule>
- /etc/apache/sites-enable/defalut
CustomLog /var/log/apache2/deflate.log deflate- mod_deflate を有効化
# a2enmod deflate
# apache2ctl restart
- mod_deflate が有効になっているかどうかのチェック
w3m と gunzip を利用して簡単にチェックが可能.
% w3m -dump_source http://example.com/ | gunzip
- 2008 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2007 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2006 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2005 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2004 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2003 : 01 02 03 04 05 06 07 08 09 10 11 12
- 2002 : 01 02 03 04 05 06 07 08 09 10 11 12
2006-02 /