Jon AtkinsonI'm a web developer and system administrator

YSlow, expires header and compression

Posted on 21st September 2009. Tagged as web, tips, debian, apache

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'.

blog comments powered by Disqus

Twitter

About Me

Picture of Jon Atkinson

Jon Atkinson is a web developer, sysadmin and occasional business guy. He works in the north west of England.

Jon can be contacted at , or on freenode as JonA. Also available: twitter, LinkedIn and Github.

My Company

Testled logo

I'm a director of Testled, a company which provides bespoke web and mobile development for all kinds of businesses.

If you're interested in working with me, take a look, then contact me via Testled.