server { listen 3000; server_name localhost; root /usr/share/nginx/html; index index.html; # Enable compression gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript; location / { try_files $uri $uri/ /index.html; expires 1h; add_header Cache-Control "public, no-transform"; } # Serve pre-compressed files if they exist location ~ \.(?:js|css|html)$ { gzip_static on; expires 1h; add_header Cache-Control "public, no-transform"; } }