Optimize Nginx for serving static assets like images, CSS, and JavaScript.
Browser Caching
location ~* \.(jpg|jpeg|png|gif|ico|svg|webp)$ {\n expires 30d;\n add_header Cache-Control "public, immutable";\n access_log off;\n}\n\nlocation ~* \.(css|js|woff|woff2|ttf|eot)$ {\n expires 7d;\n add_header Cache-Control "public";\n access_log off;\n}Gzip Static Files
gzip_static on;Pre-compress files: gzip -k style.css creates style.css.gz. Nginx serves the pre-compressed version automatically.
sendfile
sendfile on;\ntcp_nopush on;\ntcp_nodelay on;