Expires headers in Apache2 on Debian
Do you want to enable Expires: headers on your Debian web-server? It
takes three steps:
- Get mod_expires loaded into apache by symlinking expires.load in /etc/apache2/mods-enabled.
- Enable expires header in your specific site by adding the directive ExpiresActive On in 000-default or wherever you configure Apache.
- Enable a default expiration policy by adding the directive ExpiresDefault "now plus 2 days".
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.