nginx config formatter
Processed in your browser · nothing is uploaded
Reindents an nginx configuration by block depth. Braces set the level, directives sit inside, and blank lines between blocks are kept to one.
How to use the nginx config formatter
nginx configuration is a tree of blocks, and depth is the only thing indentation communicates: the parser ignores whitespace entirely. What indentation buys you is seeing which location a directive belongs to, and that matters because nginx directive inheritance is genuinely surprising: a directive in a location block does not merge with the same directive in the enclosing server block, it replaces it.
The classic case is proxy_set_header. Setting one header inside a location discards every proxy_set_header from the enclosing scope, so the Host header you set at server level silently disappears. Seeing the nesting clearly is how you notice.
One thing this does not do is validate. nginx -t is the only authority on whether a config is correct, and it checks things no formatter can, that referenced files exist, that a certificate matches its key, that a directive is legal in the context it appears in.
Questions
No, it is ignored. What it buys you is seeing which block a directive belongs to.
Directives in a location block replace the enclosing block’s rather than merging with them. Setting one discards the rest.
No. Run nginx -t. It checks referenced files, certificates and directive context, which no formatter can.
No. Everything inside a directive line is left exactly as written.
No. Everything runs in your browser, which matters when the file holds credentials or customer data.