<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/mod_deflate'
         s:cUser='brandon'
         s:oUser=''
         s:mUser='abdallah'>
        <s:name>knowledgebase/linux/webserver/apache/mod_deflate</s:name>
        <s:content>The Apache mod_deflate module compresses output on your server before sending it to the client.  All modern browsers support this feature, and it is an easy way to stretch your bandwidth a little farther.  Depending on the content on your site, you can see bandwidth savings of up to 25%&#xD;&#xA;&#xD;&#xA;To enable, make sure that you have the Apache mod_deflate module installed (it is by default on most installations).   Then simply put copy/paste these settings into your Apache config file&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;## Enable the module&#xD;&#xA;LoadModule deflate_module modules/mod_deflate.so&#xD;&#xA;&#xD;&#xA;# Create the output filter&#xD;&#xA;SetOutputFilter DEFLATE&#xD;&#xA;&#xD;&#xA;# Netscape 4.x has some problems...&#xD;&#xA;BrowserMatch ^Mozilla/4 gzip-only-text/html&#xD;&#xA;&#xD;&#xA;# Netscape 4.06-4.08 have some more problems&#xD;&#xA;BrowserMatch ^Mozilla/4.0[678] no-gzip&#xD;&#xA;&#xD;&#xA;# MSIE masquerades as Netscape, but it is fine&#xD;&#xA;BrowserMatch \\\\bMSIE !no-gzip !gzip-only-text/html&#xD;&#xA;&#xD;&#xA;## Don&apos;t compress for IE5.0&#xD;&#xA;BrowserMatch &quot;MSIE 5.0&quot; no-gzip&#xD;&#xA;&#xD;&#xA;# Don&apos;t compress images, flash, PDFs, or JavaScript&#xD;&#xA;# You might want to add more extensions to this list such as ogg|mp3|mov|avi&#xD;&#xA;SetEnvIfNoCase Request_URI.(?:gif|jpe?g|png|swf|js|pdf)$ no-gzip dont-vary&#xD;&#xA;&#xD;&#xA;# Make sure proxies don&apos;t deliver the wrong content&#xD;&#xA;Header append Vary User-Agent env=!dont-vary&#xD;&#xA;&#xD;&#xA;## Sset up some stuff for mod_deflate stats&#xD;&#xA;DeflateFilterNote Input instream&#xD;&#xA;DeflateFilterNote Output outstream&#xD;&#xA;DeflateFilterNote Ratio ratio&#xD;&#xA;&#xD;&#xA;LogFormat &apos;&quot;%r&quot; %{outstream}n/%{instream}n (%{ratio}n%%)&apos; deflate&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;## END mod_deflate configuration&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Sometimes you want to deflate only text files. For that, comment out the SetEnvIfNoCase line and replace the &quot;SetOutputFilter DEFLATE&quot; line with the following:&#xD;&#xA;{code}&#xD;&#xA;AddOutputFilterByType DEFLATE text/css text/csv text/html text/plain application/xml application/xhtml+xml image/x-icon&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Now, you can also add some extra logging to a virtual host to have the module save compression statistics about each request&#xD;&#xA;{code}&#xD;&#xA;  CustomLog /\var/logs/httpd/deflate.log deflate&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Once you&apos;ve made all of these changes to the Apache config, restart Apache to have them take effect.&#xD;&#xA;&#xD;&#xA;Once you&apos;ve been serving compressed files for a little while, you can use a script like the one at http://prefetch.net/code/deflate-stats.pl to analyze the deflate_log and tell you how much bandwidth you have saved.&#xD;&#xA;&#xD;&#xA;You can also use this handy link to test your setup, and if your browser is sending the right Accept-Encoding:&#xD;&#xA;&#xD;&#xA;http://www.whatsmyip.org/mod_gzip_test/&#xD;&#xA;&#xD;&#xA;If your enabling mod_deflate because your site seems slow, and uses a lot of images or multimedia files, this link may be helpful:&#xD;&#xA; &#xD;&#xA;http://developer.yahoo.com/performance/rules.html&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;</s:content>
        <s:mTime>2007-10-29 01:44:56.0</s:mTime>
        <s:cTime>2007-02-08 19:33:14.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='#brandon'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/qmail notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/xen'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/monit service monitoring'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/networking/Establishing a VPN connection to a Windows Server using PPTP'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/moving imap folders between hosts'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/maildrop with mysql support on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/tomcat on plesk'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/mail not going through'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/rimuhosting ssh access'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/Security/Responding to attacks using fail2ban'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
