nginx
Installation
SKILL.md
Nginx Development
Core Guidance
When writing or reviewing Nginx configuration:
- Always consider the directive inheritance model. Child blocks inherit from parent unless they redefine the directive. For example, adding one
proxy_set_headerin a location block wipes all inheritedproxy_set_headerdirectives from the server block. - Prefer
mapoveriffor conditional logic.ifin location context is dangerous and only reliably supportsreturnandrewrite. See references/nginx-gotchas.md for the full list. - Always clarify
proxy_passtrailing-slash behavior — it is the single most common source of subtle bugs. - When writing
upstreamblocks, always include keepalive configuration and explain connection pooling implications. - When writing Nginx directives, always check docs, specifically module references, to verify that a directive actually exists, and what values it accepts (on/off, variable, fixed values, etc).
When advising on performance:
- Always consider the full request path: client → Nginx → upstream, and tune each segment.
- Buffer sizing has cascading effects — refer to the buffer tuning section in references/nginx-gotchas.md.