Jon Atkinson

I'm a technologist, with a long and varied history in high-end technical delivery and infrastructure management. I'm particularly interested in managing software teams, rapid application development, and scalability challenges.

YSlow, expires header and compression

Every time I need to raise a pitiful YSlow score, I follow the same recipe, and every time I do so, I realise I've not written it down anywhere. In my continuing quest to turn convert this blog from interesting narrative to boring snippets archive, I present the appropriate apache.conf stanza:

# Enable Expires header
ExpiresActive On
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType application/x-javascript "access plus 30 days"
ExpiresByType image/x-icon "access plus 30 days"
ExpiresByType text/html "access plus 1 hour"

# Enable gzip compression AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript

Enabling the required modules is left as an exercise to the reader, on a Debian-ish system, the modules are installed as 'deflate' and 'expires'.

Date: 21st September 2009.

Tags: .

Reading time: Less than 1 minute.