Your files stay on your device

# nginx config explainer

Paste an nginx.conf snippet: every directive explained in its block context, unknowns counted, nothing loaded or tested.
Loading editor…

Every directive is explained in its block, like http, server, or location. Directives this page doesn't know are counted instead of guessed.

## The add_header inheritance rule

add_header directives pass down from a server block into its locations only when the location defines none of its own. The moment a location adds one header, every add_header from the outer block is dropped for that location. Security headers set at the server level can therefore vanish on one path, and the fix is to repeat them in the location or move them into a shared include.

## Trailing slashes in proxy_pass

proxy_pass http://backend; passes the request URI as it arrived. Adding a URI after the host, as in http://backend/api/;, makes nginx replace the matched location prefix with that URI. A one-character difference in the slash changes which path the upstream receives, so compare both forms before copying one.

## Reading the block context

- A directive belongs to the nearest enclosing block, such as server or location.
- Directives such as proxy_pass only make sense inside a location block.
- Unknown directives are counted by the explainer rather than guessed at.

## More config file tools

- [SSH config explainer](/config/ssh)
- [DNS explainer](/network/dns-explain)
- [Redirect rule generator](/config/htaccess-redirect-generator)
[All config file tools](/config)

Was this tool useful?
YesNo

---

Canonical HTML: https://nutter.tools/config/nginx
Markdown version: https://nutter.tools/config/nginx.md
Plain-text version: https://nutter.tools/config/nginx.txt
Agent index: https://nutter.tools/llms.txt

