server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Compression gzip on; gzip_comp_level 5; gzip_min_length 1024; gzip_types text/plain text/css application/javascript image/svg+xml application/json; # Long cache for static assets (images, video, fonts, css/js) location ~* \.(?:css|js|jpg|jpeg|png|webp|gif|ico|svg|mp4|woff2?)$ { expires 7d; add_header Cache-Control "public"; access_log off; } # Serve files directly; .html pages resolve by their own URL location / { try_files $uri $uri/ =404; } }