-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
82 lines (72 loc) · 2.47 KB
/
nginx.conf
File metadata and controls
82 lines (72 loc) · 2.47 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
77
78
79
80
81
82
server {
listen 3000;
listen [::]:3000;
server_name _;
root /usr/share/nginx/html;
index index.html;
# ---------- Security headers ----------
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=(), interest-cohort=()" always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Cross-Origin-Resource-Policy "same-origin" always;
# HSTS only takes effect when served over HTTPS at the edge (ingress / LB).
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# ---------- Gzip compression ----------
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;
# ---------- Long-term cache for hashed assets ----------
location /assets/ {
access_log off;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable" always;
add_header X-Content-Type-Options "nosniff" always;
try_files $uri =404;
}
# Hashed static files (favicon, fonts, etc.) get a shorter cache
location ~* \.(?:ico|svg|png|jpg|jpeg|gif|webp|woff2?|ttf|otf|eot)$ {
access_log off;
expires 7d;
add_header Cache-Control "public, max-age=604800" always;
try_files $uri =404;
}
# ---------- Never cache the entry HTML ----------
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header X-Content-Type-Options "nosniff" always;
expires 0;
}
# robots.txt and version.json are always-fresh
location = /robots.txt {
access_log off;
add_header Cache-Control "public, max-age=3600" always;
}
location = /version.json {
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;
}
}