Categories
Uncategorized

Apache: Use mod_deflate.

同一記事の日本語版

   Yesterday, I changed several settings in Apache conf file.

   Open the httpd.conf.

  1. Uncomment the line to use the module mod_deflate for HTTP compression.
          LoadModule deflate_module modules/mod_deflate.so
  2. Uncomment the line to use the directive AddOutputFilterByType
          LoadModule filter_module modules/mod_filter.so
  3. Uncomment the line to use the directive Header
          LoadModule headers_module modules/mod_headers.so
  4. Uncomment the line to use the module mod_expires.
          LoadModule expires_module modules/mod_expires.so

   Add the next lines to the httpd.conf. About this, I have something not to understand, though.
      # Enables generation of Expires headers
      ExpiresActive On
      # expire images and some applications after a month in the client’s cache
      ExpiresByType image/gif A2592000
      ExpiresByType image/jpeg A2592000
      ExpiresByType image/png A2592000
      ExpiresByType text/javascript A2592000
      ExpiresByType text/css A2592000
      ExpiresByType application/javascript A2592000
      ExpiresByType application/x-font-woff A2592000
      # HTML documents are good for a week from the time they were changed
      ExpiresByType text/html M604800
      ExpiresByType text/plain M604800
      ExpiresByType text/xml M604800
      # Enabling Compression
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4.0[678] no-gzip
      BrowserMatch bMSIEs(7|8) !no-gzip !gzip-only-text/html
      # Make sure proxies don’t deliver the wrong content
      SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ dont-vary
      Header append Vary User-Agent env=!dont-vary

Leave a Reply

Your email address will not be published. Required fields are marked *