Do you want to enable Expires: headers on your Debian web-server? It takes three steps:
  1. Get mod_expires loaded into apache by symlinking expires.load in /etc/apache2/mods-enabled.
  2. Enable expires header in your specific site by adding the directive ExpiresActive On in 000-default or wherever you configure Apache.
  3. Enable a default expiration policy by adding the directive ExpiresDefault "now plus 2 days".
The expires header makes me a bit nervous. Pages render faster because the browser doesn't even do a HEAD request if it's in the period. But if the file actually changed, the browser will never know about it. Sort of the same problem with DNS cache times. It makes a lot of sense for static assets like images you never change.

Update: I hadn't realized how many non-static images I had on my server. Pretty much any script that generates graphs from realtime data, for instance. I have a lot of rrdgraphs and the expires header breaks them. Oops!

All this is motivated by Yahoo's guide for speeding up websites. Along with the YSlow tool webmasters have no excuse for not knowing why their site renders slowly. Some of their suggestions are a bit complicated for a small site (no content distribution network for my blog, sorry). But any serious web company should take a long hard look at its reports.

  2008-03-21 16:45 Z