2012-07-22 23:31:54 +02:00
|
|
|
# Expire rules for static content
|
|
|
|
|
|
|
|
# No default expire rule. This config mirrors that of apache as outlined in the
|
|
|
|
# html5-boilerplate .htaccess file. However, nginx applies rules by location,
|
|
|
|
# the apache rules are defined by type. A concequence of this difference is that
|
|
|
|
# if you use no file extension in the url and serve html, with apache you get an
|
|
|
|
# expire time of 0s, with nginx you'd get an expire header of one month in the
|
|
|
|
# future (if the default expire rule is 1 month). Therefore, do not use a
|
|
|
|
# default expire rule with nginx unless your site is completely static
|
|
|
|
|
|
|
|
# cache.appcache, your document html and data
|
|
|
|
location ~* \.(?:manifest|appcache|html|xml|json)$ {
|
|
|
|
expires -1;
|
|
|
|
access_log logs/static.log;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Feed
|
|
|
|
location ~* \.(?:rss|atom)$ {
|
|
|
|
expires 1h;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Favicon
|
|
|
|
location ~* \.ico$ {
|
|
|
|
expires 1w;
|
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
|
|
|
|
2012-08-19 18:27:13 +02:00
|
|
|
# Media: images, video, audio, HTC
|
|
|
|
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm)$ {
|
2012-07-22 23:31:54 +02:00
|
|
|
expires 1M;
|
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
|
|
|
|
|
|
|
# CSS and Javascript
|
|
|
|
location ~* \.(?:css|js)$ {
|
|
|
|
expires 1y;
|
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
}
|
2012-08-19 18:27:13 +02:00
|
|
|
|
|
|
|
# WebFonts
|
|
|
|
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
|
|
|
|
# location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
|
|
|
|
# expires 1M;
|
|
|
|
# access_log off;
|
|
|
|
# add_header Cache-Control "public";
|
|
|
|
# }
|