Speeding up apache by mod_deflate and mod_expires
November 5th, 2008 by vickyHere is how I speed up apache by compressing pages with mod_deflate module and setting higher cache expiration times in mod_expires module. Here is how…
put this in your apache config:
<IfModule mod_deflate.c>
# compress html, plain text, css and javascript
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/x-javascript
# avoid problems in known-to-be-problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A300
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A3600
ExpiresByType text/css A3600
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType text/plain A300
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A2592000
ExpiresByType application/pdf A300
ExpiresByType text/html A300
</IfModule>
Times are in seconds. There are many variations how to set the time, read apache manual for further info.
Hope it helps to speed up your sites and save some bandwidth.
Posted in General linux admin | No Comments »