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,
|
2014-11-17 19:28:45 +01:00
|
|
|
# the apache rules are defined by type. A consequence of this difference is that
|
2012-07-22 23:31:54 +02:00
|
|
|
# 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
|
2013-03-24 18:46:39 +01:00
|
|
|
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
|
2018-03-06 20:53:04 +01:00
|
|
|
expires 0;
|
2012-07-22 23:31:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# Feed
|
|
|
|
location ~* \.(?:rss|atom)$ {
|
2018-03-06 20:53:04 +01:00
|
|
|
expires 1h;
|
2012-07-22 23:31:54 +02:00
|
|
|
}
|
|
|
|
|
2013-02-24 21:25:59 +01:00
|
|
|
# Media: images, icons, video, audio, HTC
|
2016-03-21 15:07:58 +01:00
|
|
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
|
2012-07-22 23:31:54 +02:00
|
|
|
access_log off;
|
2018-03-06 20:53:04 +01:00
|
|
|
expires 1M;
|
2012-07-22 23:31:54 +02:00
|
|
|
}
|
|
|
|
|
2016-03-21 15:07:58 +01:00
|
|
|
# Media: svgz files are already compressed.
|
|
|
|
location ~* \.svgz$ {
|
|
|
|
access_log off;
|
|
|
|
gzip off;
|
2018-03-06 20:53:04 +01:00
|
|
|
expires 1M;
|
2016-03-21 15:07:58 +01:00
|
|
|
}
|
|
|
|
|
2012-07-22 23:31:54 +02:00
|
|
|
# CSS and Javascript
|
|
|
|
location ~* \.(?:css|js)$ {
|
2018-03-06 20:53:04 +01:00
|
|
|
expires 1y;
|
2012-07-22 23:31:54 +02:00
|
|
|
access_log off;
|
|
|
|
}
|
2012-08-19 18:27:13 +02:00
|
|
|
|
|
|
|
# WebFonts
|
|
|
|
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
|
2014-09-03 14:28:54 +02:00
|
|
|
# location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
|
2018-03-06 20:53:04 +01:00
|
|
|
# expires 1M;
|
2012-08-19 18:27:13 +02:00
|
|
|
# access_log off;
|
|
|
|
# }
|