Replace location block `add_header` directives with `expires` directives
Fixes https://github.com/h5bp/server-configs-nginx/issues/193
This commit is contained in:
parent
c5c6602232
commit
135d093a75
|
@ -8,5 +8,5 @@ location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
|
||||||
# And https://github.com/h5bp/server-configs/issues/85
|
# And https://github.com/h5bp/server-configs/issues/85
|
||||||
# And https://github.com/h5bp/server-configs/issues/86
|
# And https://github.com/h5bp/server-configs/issues/86
|
||||||
access_log off;
|
access_log off;
|
||||||
add_header Cache-Control "max-age=2592000";
|
expires 1M;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,36 +10,36 @@
|
||||||
|
|
||||||
# cache.appcache, your document html and data
|
# cache.appcache, your document html and data
|
||||||
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
|
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
|
||||||
add_header Cache-Control "max-age=0";
|
expires 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Feed
|
# Feed
|
||||||
location ~* \.(?:rss|atom)$ {
|
location ~* \.(?:rss|atom)$ {
|
||||||
add_header Cache-Control "max-age=3600";
|
expires 1h;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Media: images, icons, video, audio, HTC
|
# Media: images, icons, video, audio, HTC
|
||||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|mp4|ogg|ogv|webm|htc)$ {
|
||||||
access_log off;
|
access_log off;
|
||||||
add_header Cache-Control "max-age=2592000";
|
expires 1M;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Media: svgz files are already compressed.
|
# Media: svgz files are already compressed.
|
||||||
location ~* \.svgz$ {
|
location ~* \.svgz$ {
|
||||||
access_log off;
|
access_log off;
|
||||||
gzip off;
|
gzip off;
|
||||||
add_header Cache-Control "max-age=2592000";
|
expires 1M;
|
||||||
}
|
}
|
||||||
|
|
||||||
# CSS and Javascript
|
# CSS and Javascript
|
||||||
location ~* \.(?:css|js)$ {
|
location ~* \.(?:css|js)$ {
|
||||||
add_header Cache-Control "max-age=31536000";
|
expires 1y;
|
||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
# WebFonts
|
# WebFonts
|
||||||
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
|
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
|
||||||
# location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
|
# location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
|
||||||
# add_header Cache-Control "max-age=2592000";
|
# expires 1M;
|
||||||
# access_log off;
|
# access_log off;
|
||||||
# }
|
# }
|
||||||
|
|
Loading…
Reference in New Issue