httpd2.4のgzip設定

alkoshikawa 298views 更新:2014年5月30日
vim /etc/httpd/conf.d/gzip.conf
---
SetOutputFilter DEFLATE

DeflateCompressionLevel 5

#IE6 has some problems...
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE\s(7|8) !no-gzip

FilterDeclare Compression CONTENT_SET
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider  COMPRESS  DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain Compression

# Don't append Vary heder for specific files
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|zip|lzh|exe)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
Header append Vary Accept-Encoding env=!dont-vary
---

ログイン / 新規登録してコメントする

このソースコードをストックして後で利用したり、作業に利用したソースコードをまとめることができます。

こちらもお役に立つかもしれません