Jonathan Polansky

A pretty good webpage.

Enable gzip for css and javascript to satisfy Google Webmaster tools

Today I was dealing with ruxable crashing over the weekend so I spent some time reviewing the configuration of the server. Everything is still incredibly simple (read more about the AMI and configuration I use) but while reviewing the Google Webmaster Tools analysis, I found that gzip compression wasn’t enabled for css and javascript. This is a big no-no for them and should be incredibly easy to enable. Turns out it was. mod_deflate is the equivalent of mod_gzip for Apache 2 and the module was already installed and enabled for my CentOS provided version of Apache. To apply it to my css and js, I just added the following lines into the Directory block for my document root:

# Enable css and js compression
AddOutputFilterByType DEFLATE text/css application/x-javascript

Tagged as , , , , , + Categorized as Tech

Leave a Reply