Basic Caching Headers in Nginx
To add basic caching headers for different filetypes, add an
expires directive to your nginx config file, like this:
off means no caching headers.
epoch is no caching, ask the website itself.
max is the maximum, cache as long as you can.
~ in the mimetype indicates a regular expression.
It could be that this does not work right away for fonts, as nginx defaults to the
application/octet-stream mimetype for those filetypes. To fix this, add these lines to the
font/ttf ttf; font/opentype otf; application/font-woff woff;
Don’t forget to add the first two to the list of gzipped mimetypes, the last is already a compressed format:
gzip_types text/plain text/css ... font/ttf font/opentype;
/etc/nginx/nginx.conf (on Debian).