server { listen 3000; server_name localhost; root /usr/share/nginx/html; index index.html; # Gzip compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript application/json image/svg+xml; gzip_disable "MSIE [1-6]\."; # Prevent caching for runtime configuration and entry html location ~* (env-config\.js|config\.json|index\.html)$ { expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; } # Static assets caching with hash location /assets/ { expires 1y; add_header Cache-Control "public, max-age=31536000, immutable"; } # Single Page Application fallback routing location / { try_files $uri $uri/ /index.html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }