server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Angular HTML5 routing location / { try_files $uri $uri/ /index.html; } # Hashed assets — cache forever location ~* \.(js|css|woff2?|ttf|eot|svg|ico|png|jpg|webp)$ { expires 1y; add_header Cache-Control "public, immutable"; access_log off; } # Never cache index.html location = /index.html { add_header Cache-Control "no-store, no-cache, must-revalidate"; } gzip on; gzip_vary on; gzip_min_length 1024; gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript; }