WillSquire
3/22/2016 - 11:41 AM

Install and configure mod_deflate on FreeBSD

Install and configure mod_deflate on FreeBSD

Install and configure mod_deflate on FreeBSD

Open Apache config file:

sudo ee /usr/local/etc/apache24/httpd.conf

Ensure the following in uncommented, then save and exit the file (remove # if present at the start of the line):

LoadModule deflate_module libexec/apache24/mod_deflate.so

Create a mod_deflate config file (note apache24 may vary depending on the version of Apache installed):

sudo ee /usr/local/etc/apache24/Includes/mod_deflate.conf

Add the configuration settings to the file, then save and exit (note: other files can be added to compression by adding them to the list via their MIME type. AddOutputFilterByType DEFLATE image/svg+xml has been added to the end of these default settings to enable compression of SVGs):

<IfModule mod_deflate.c>
        <IfModule mod_filter.c>
                # these are known to be safe with MSIE 6
                AddOutputFilterByType DEFLATE text/html text/plain text/xml

                # everything else may cause problems with MSIE 6
                AddOutputFilterByType DEFLATE text/css
                AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
                AddOutputFilterByType DEFLATE application/rss+xml
                AddOutputFilterByType DEFLATE application/xml
                AddOutputFilterByType DEFLATE image/svg+xml
        </IfModule>
</IfModule>

Restart Apache:

sudo apachectl graceful

###References