worker_processes auto; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; keepalive_timeout 65; gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml font/woff2; server { listen 80; listen 3000; server_name localhost; root /usr/share/nginx/html; index index.html; # Hashed build output is immutable, so cache it hard. location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } # Never cache the shell: it points at the current hashed assets. location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } # Hand unknown paths to React Router. location / { try_files $uri $uri/ /index.html; } } }