カスタム検索
|
Tweet |
|
|
コンテンツを圧縮転送させる方法
Created: 9 September 2007
設定方法
モジュールは、"mod_deflate"と、"mod_headers"が必要です。
LoadModule deflate_module modules/mod_deflate.so LoadModule headers_module modules/mod_headers.so"/etc/httpd/conf.d/deflate.conf"を作成すると、実現でできます。
DeflateCompressionLevel 5 ← 圧縮レベル(1 - 9) <Directory /var/www/html/test1> SetOutputFilter DEFLATE ← 圧縮を有効にする </Directory> <Directory /var/www/html/test2> AddOutputFilter DEFLATE .html ← 圧縮するファイルの拡張子を指定 </Directory> <Location /> SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4\.0[678] no-gzip ← Netscape4.xでは圧縮しない BrowserMatch ^Mozilla/4 gzip-only-text/html ← IE&Firefoxでは、text/htmlのみ圧縮 BrowserMatch ^Mozilla/5 gzip-only-text/html ← IE&Firefoxでは、text/htmlのみ圧縮 SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gip dont-vary ← 画像は非圧縮 Header append Vary User-Agent env=!dont-vary </Location> # 以下はログ出力の指定 DeflateFilterNote Input instream DeflateFilterNote Output outstream DeflateFilterNote Ratio ratio LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%) %{User-agent}i' deflate Customlog logs/deflate_log deflate