42 lines
1.1 KiB
Nginx Configuration File
Executable File
42 lines
1.1 KiB
Nginx Configuration File
Executable File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
gzip on;
|
|
gzip_types text/css application/javascript application/json image/svg+xml;
|
|
|
|
# Fingerprinted build output can be cached forever.
|
|
location /static/ {
|
|
try_files $uri =404;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
|
|
# Exchangeable graphics (public/assets) are not fingerprinted; revalidate them
|
|
# so replaced files show up immediately.
|
|
location /assets/ {
|
|
try_files $uri =404;
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
location = /config.js {
|
|
add_header Cache-Control "no-store";
|
|
}
|
|
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache";
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ @prefixed;
|
|
}
|
|
|
|
# The reverse proxy may forward a sub-path without stripping it (e.g. /website/static/x.js).
|
|
# Drop the leading path segment and try again; fall back to the app's index.html.
|
|
location @prefixed {
|
|
rewrite ^/[^/]+(/.*)$ $1 last;
|
|
rewrite ^ /index.html last;
|
|
}
|
|
}
|