server { listen 8080; server_name _; root /usr/share/nginx/html; index index.html; # A single-page app: every path that is not a file on disk is the app's own # route, and the app is what decides what it means. Without this, a reload # anywhere but the root is a 404 from nginx. location / { try_files $uri $uri/ /index.html; } # Hashed filenames, so the content at a given name never changes. index.html # is deliberately not in here: it is the file that names the current hashes, # and a cached one pins a deployment to the build it replaced. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } location = /index.html { add_header Cache-Control "no-cache"; } }