Enabling Compression in Apache

Subject:

Enabling compression in Apache takes just a single line. This can be added in numerous places, but for now, we’ll add it to the end of the main config file.

So, open the config file as before with this:

       nano /etc/httpd/conf/httpd.conf

and move to the end of the file. The quickest way to do this is to hold down Ctrl+V until you reach the end. Once you’re at the end, append this line of text (for formatting rea- sons, it appears as two lines here, but it should be one line in your configuration file):

       AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css

       application/javascript application/x-javascript

Save the file as before, and restart Apache. You should now find that you are provid- ing compressed content to the world! Currently you have only told Apache to compress the text files that you will most commonly use on your web site by specifying their MIME types. To find a list of possible MIME types that you can compress, take a look (using nano) in /etc/mime.types 

2015-02-18 09:29:48gstlouis