server { listen 80; root /usr/share/nginx/html; index index.html; # Gzip compression gzip on; gzip_vary on; gzip_min_length 256; gzip_comp_level 6; gzip_types text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml; # Static assets with hash in filename — long cache location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } # SPA fallback location / { try_files $uri $uri/ /index.html; add_header Cache-Control "no-cache"; } location /api/ { return 404; } }