Last-modified: 2011-12-26 (月) 01:24:42
Apache/圧縮通信がしたい

概要

パフォーマンスを向上させるために、コンテンツをgzipで圧縮します。

方法

  1. <Apacheルート>/conf/httpd.confを開きます。
    Everything is expanded.Everything is shortened.
      1
      2
      3
      4
      5
      6
      7
      8
    
    -
    !
     
    -
    !
    -
    !
     
    
    # 圧縮通信
    LoadModule deflate_module modules/mod_deflate.so
     
    # 圧縮設定
    <IfModule deflate_module>
        # html,plain,xml,css,javascriptをgzipで圧縮して送信する
        AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript
    </IfModule>
  2. Apacheを再起動します。
    Everything is expanded.Everything is shortened.
      1
    
     
    
    /etc/init.d/httpd restart

確認

  1. YSlowを起動します。
    WS000000.PNG
  2. [Components]タブに移動し、ドキュメントやXML、CSS、javascriptファイルがあれば開きます。
    [GZIP]欄を確認し、圧縮後のサイズが表示されていれば成功です。

検証時の環境

参考