-
Notifications
You must be signed in to change notification settings - Fork 75
/
nginx.conf
61 lines (46 loc) · 1.36 KB
/
nginx.conf
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
server {
listen 80;
listen [::]:80;
server_name localhost;
gzip on;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript;
gzip_min_length 1024;
gzip_vary on;
root /usr/share/nginx/html;
etag off;
include mime.types;
types {
# Manifest files
application/manifest+json webmanifest;
}
# all assets contain hash in filename, cache forever
location /assets/ {
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}
# all workbox scripts are compiled with hash in filename, cache forever
location ^~ /workbox- {
add_header Cache-Control "public, max-age=31536000, s-maxage=31536000, immutable";
try_files $uri =404;
}
# image assets can be cached for a month
location /images/ {
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
}
# assume that everything else is handled by the application router, by injecting the index.html
location / {
autoindex off;
expires off;
add_header Cache-Control "public, max-age=0, s-maxage=0, must-revalidate" always;
try_files $uri /index.html =404;
}
location /404.html {
internal;
}
location /50x.html {
internal;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
}