64 lines
2.2 KiB
Nginx Configuration File
64 lines
2.2 KiB
Nginx Configuration File
# ----------------------------------------------------------------------
|
|
# | Cache expiration |
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Serve resources with a far-future expiration date.
|
|
#
|
|
# (!) If you don't control versioning with filename-based cache busting, you
|
|
# should consider lowering the cache times to something like one week.
|
|
#
|
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
|
|
# https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires
|
|
|
|
map $sent_http_content_type $expires {
|
|
# Default: Fallback
|
|
default 1y;
|
|
|
|
# Default: No content
|
|
"" off;
|
|
|
|
# Specific: Assets
|
|
~*image/svg\+xml 1y;
|
|
~*image/vnd.microsoft.icon 1w;
|
|
~*image/x-icon 1w;
|
|
|
|
# Specific: Manifests
|
|
~*application/manifest\+json 1w;
|
|
~*text/cache-manifest epoch;
|
|
|
|
# Specific: Data interchange
|
|
~*application/atom\+xml 1h;
|
|
~*application/rdf\+xml 1h;
|
|
~*application/rss\+xml 1h;
|
|
|
|
# Specific: Documents
|
|
~*text/html epoch;
|
|
~*text/markdown epoch;
|
|
~*text/calendar epoch;
|
|
|
|
# Specific: Other
|
|
~*text/x-cross-domain-policy 1w;
|
|
|
|
# Generic: Data
|
|
~*json epoch;
|
|
~*xml epoch;
|
|
|
|
# Generic: WebAssembly
|
|
# ~*application/wasm 1y; # default
|
|
|
|
# Generic: Assets
|
|
# ~*application/javascript 1y; # default
|
|
# ~*application/x-javascript 1y; # default
|
|
# ~*text/javascript 1y; # default
|
|
# ~*text/css 1y; # default
|
|
|
|
# Generic: Medias
|
|
# ~*audio/ 1y; # default
|
|
# ~*image/ 1y; # default
|
|
# ~*video/ 1y; # default
|
|
# ~*font/ 1y; # default
|
|
}
|
|
|
|
expires $expires;
|