add more file extensions to cache in nginx.conf
This commit is contained in:
parent
5aa5562484
commit
880d4c9b6f
13
nginx.conf
13
nginx.conf
|
@ -33,7 +33,7 @@ http {
|
|||
index index.html index.htm;
|
||||
error_page 404 index.html;
|
||||
|
||||
# Media: images, icons, video, audio, HTC
|
||||
# Fonts and media: images, icons, video, audio, HTC
|
||||
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|ttf)$ {
|
||||
expires 1M;
|
||||
access_log off;
|
||||
|
@ -41,22 +41,23 @@ http {
|
|||
}
|
||||
|
||||
# Javascript and CSS files
|
||||
location ~* \.(?:css|js|woff2)$ {
|
||||
location ~* \.(?:css|json|webmanifest|js|woff2|manifest)$ {
|
||||
try_files $uri =404;
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
# Any route containing a file extension (e.g. /devicesfile.js)
|
||||
location ~ ^.+\..+$ {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location / {
|
||||
# First attempt to serve request as file, then
|
||||
# as directory, then fall back to redirecting to index.html
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Any route containing a file extension (e.g. /devicesfile.js)
|
||||
location ~ ^.+\..+$ {
|
||||
try_files $uri =404;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user