fix nginx cache immutable example

This commit is contained in:
Robin Appelman
2022-02-21 15:34:54 +01:00
parent 608eb686cb
commit d70354d7bd
2 changed files with 15 additions and 10 deletions

View File

@@ -3,6 +3,13 @@ upstream php-handler {
#server unix:/var/run/php/php7.4-fpm.sock;
}
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
map $arg_v $asset_immutable {
"" "";
default "immutable";
}
server {
listen 80;
listen [::]:80;
@@ -140,16 +147,12 @@ server {
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite)$ {
try_files $uri /index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
access_log off; # Optional: Don't log access to assets
location ~ \.wasm$ {
default_type application/wasm;
}
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite)(\?v=.*)?$ {
add_header Cache-Control "public, max-age=15778463, immutable";
}
}
location ~ \.woff2?$ {

View File

@@ -3,6 +3,12 @@ upstream php-handler {
#server unix:/var/run/php/php7.4-fpm.sock;
}
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
map $arg_v $asset_immutable {
"" "";
default "immutable";
}
server {
listen 80;
listen [::]:80;
@@ -139,16 +145,12 @@ server {
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite)$ {
try_files $uri /nextcloud/index.php$request_uri;
expires 6M; # Cache-Control policy borrowed from `.htaccess`
add_header Cache-Control "public, max-age=15778463, $asset_immutable";
access_log off; # Optional: Don't log access to assets
location ~ \.wasm$ {
default_type application/wasm;
}
location ~ \.(?:css|js|svg|gif|png|jpg|ico|wasm|tflite)(\?v=.*)?$ {
add_header Cache-Control "public, max-age=15778463, immutable";
}
}
location ~ \.woff2?$ {