Repository navigation
Expand file tree
/
Copy pathnginx.conf
More file actions
56 lines (47 loc) · 1.5 KB
/
Copy pathnginx.conf
File metadata and controls
56 lines (47 loc) · 1.5 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
server {
listen 3000;
server_name _;
# Ensure redirects (like the automatic trailing slash redirects) stay on
# the public origin instead of pointing clients back to the internal
# container port. Without this Radix would issue redirects to
# `:3000`, and browsers would time out because that port isn't exposed.
absolute_redirect off;
port_in_redirect off;
root /usr/share/nginx/html;
index index.html index.htm;
# Cache static assets
location ~* \.(?:css|js)$ {
expires 1y;
add_header Cache-Control "public";
}
# SPA routing: serve index.html for all non-file paths
location / {
try_files $uri $uri/ $uri.html /index.html;
}
# Don't cache index.html to ensure updates are reflected
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate";
}
# Cache other static assets (images, fonts, etc.)
location ~* \.(?:png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Error pages
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# Enable gzip compression
gzip on;
gzip_types
text/plain
application/xml
application/javascript
application/x-javascript
text/javascript
text/xml
text/css;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
}