Linuxめも

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/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>

こちらの記事も参考にして下さい。
WordPressの速度向上


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS