-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
76 lines (65 loc) · 2.12 KB
/
nginx.conf
File metadata and controls
76 lines (65 loc) · 2.12 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
64
65
66
67
68
69
70
71
72
73
74
75
76
server {
listen 3000;
listen [::]:3000;
server_name _;
server_tokens off;
root /usr/share/nginx/html;
index index.html;
# Server-level include covers responses that don't match any location
# with its own add_header (e.g. default 50x).
include /etc/nginx/security-headers.inc;
# ---------- Gzip ----------
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain text/css text/xml text/javascript
application/javascript application/x-javascript application/json
application/xml application/xml+rss application/wasm
image/svg+xml;
# ---------- Health endpoint ----------
location = /healthz {
access_log off;
add_header Content-Type text/plain;
return 200 "ok";
}
# ---------- Hashed asset cache ----------
location /assets/ {
include /etc/nginx/security-headers.inc;
access_log off;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable" always;
try_files $uri =404;
}
location ~* \.(?:ico|svg|png|jpg|jpeg|gif|webp|woff2?|ttf|otf|eot)$ {
include /etc/nginx/security-headers.inc;
access_log off;
expires 7d;
add_header Cache-Control "public, max-age=604800" always;
try_files $uri =404;
}
# ---------- Never cache entry HTML ----------
location = /index.html {
include /etc/nginx/security-headers.inc;
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
expires 0;
}
location = /robots.txt {
include /etc/nginx/security-headers.inc;
access_log off;
add_header Cache-Control "public, max-age=3600" always;
}
location = /version.json {
include /etc/nginx/security-headers.inc;
access_log off;
add_header Cache-Control "no-store" always;
}
# ---------- SPA fallback ----------
location / {
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html { internal; }
}