Repository navigation
Expand file tree
/
Copy pathdefault.conf
More file actions
63 lines (52 loc) · 1.82 KB
/
Copy pathdefault.conf
File metadata and controls
63 lines (52 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html =404;
}
# The app shell and the worker itself must never be served from a stale cache,
# otherwise a deploy keeps shipping old bundles and old auth logic.
location = /index.html {
add_header Cache-Control "no-cache";
}
location = /sw.js {
add_header Cache-Control "no-cache";
}
location = /manifest.webmanifest {
default_type application/manifest+json;
add_header Cache-Control "no-cache";
}
# Build output carries a content hash in its name, so it can be cached forever.
location ^~ /assets/ {
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Stable file names: the service worker answers these instantly from its cache and
# revalidates in the background, so keep revalidation here cheap instead of long lived.
location ~* ^/(fonts|images|audio)/ {
add_header Cache-Control "no-cache";
}
# Icons and logo served from the site root.
location ~* ^/[^/]+\.(ico|png|svg|webp)$ {
add_header Cache-Control "no-cache";
}
# location / {
# # First attempt to serve request as file, then
# # as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
# if (!-e $request_filename){
# rewrite ^(.*)$ /index.html break;
# }
# }
}