server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Enable gzip compression gzip on; gzip_types text/html text/css application/javascript application/json; gzip_min_length 1000; location / { try_files $uri $uri/ /index.html; } # Cache static assets location ~* \.(js|css|html)$ { expires 1h; add_header Cache-Control "public, immutable"; } }