Apacheでコンテンツをgzip圧縮すると、ネットワークで送信されるバイト数を減らすことができ、結果サーバーの応答時間を短縮することができるようになります。 gzip圧縮のためにCPUリソースが使用されますので、CPU負荷が高い場合は逆効果になる恐れもあるので注意が必要です。 Apache2.2系 LoadModule deflate_module modules/mod_deflate.so LoadModule filter_module modules/mod_filter.so <Location /> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html FilterDeclare Compression CONTENT_SET FilterProvider Compression DEFLATE Content-Type $text/plain FilterProvider Compression DEFLATE Content-Type $text/html FilterProvider Compression DEFLATE Content-Type $text/css FilterProvider Compression DEFLATE Content-Type $text/javascript FilterProvider Compression DEFLATE Content-Type $application/javascript FilterProvider Compression DEFLATE Content-Type $application/xhtml FilterProvider Compression DEFLATE Content-Type $application/xml FilterProvider Compression DEFLATE Content-Type $application/xhtml+xml FilterProvider Compression DEFLATE Content-Type $application/rss+xml FilterProvider Compression DEFLATE Content-Type $application/atom+xml FilterProvider Compression DEFLATE Content-Type $application/x-javascript FilterProvider Compression DEFLATE Content-Type $image/svg+xml FilterChain Compression SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|zip|lzh|exe)$ dont-vary Header append Vary User-Agent env=!dont-vary Header append Vary Accept-Encoding env=!dont-vary </Location> Apache2.4系 LoadModule deflate_module modules/mod_deflate.so LoadModule filter_module modules/mod_filter.so <Location /> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html FilterDeclare Compression CONTENT_SET FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='text/plain'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}=~m#^text\/html#" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='text/css'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='text/javascript'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/javascript'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/xhtml'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/xml'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/xhtml+xml'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/rss+xml'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/atom+xml'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='application/x-javascript'" FilterProvider Compression DEFLATE "%{CONTENT_TYPE}='image/svg+xml'" FilterChain Compression SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png|zip|lzh|exe)$ dont-vary Header append Vary User-Agent env=!dont-vary Header append Vary Accept-Encoding env=!dont-vary </Location> こちらの記事も参考にして下さい。 |