Nginx config validator
Check nginx configuration syntax in the browser: a hand-written lexer verifies server/location/upstream/http block nesting, missing semicolons, unbalanced { } and quotes, and flags unknown directives as warnings — every finding comes with a line number and severity.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Validation result
Type some configuration above and the findings show up here.
What this tool does
- Run a quick pass over nginx.conf after editing: missing semicolons, stray braces and unclosed blocks show up without waiting for `nginx -t` on the server.
- Get oriented in an inherited configuration — the tool reports how many directives and blocks there are and how deeply they nest.
- Debug “why is my config ignored”: misplaced blocks such as a location inside http or a server at the top level are flagged directly.
- See at a glance which directives come from third-party modules: anything outside the whitelist is only a warning.
Example
Input
events {
worker_connections 1024
}Output
Line 2 Error Directive worker_connections is missing its trailing ;
Every directive must end with ; and blocks are wrapped in { } — mismatches are reported on their own line.
Frequently asked questions
Does this tool execute my configuration?
No. It only lexes the file and checks the structure: nginx is never started, no module is loaded, no server is contacted and nothing is uploaded. To know whether nginx itself accepts the file, run `nginx -t` on the server.
Why is a location inside http an error?
nginx only allows location inside server (or another location). Putting one directly in http is a structural error and nginx refuses to start. Likewise server must live in http / stream / mail, and upstream must live in http / stream.
Are “unknown directive” findings errors?
They are warnings only. The whitelist covers the common directives of the nginx core, events, http, stream and mail modules; directives added by third-party modules (lua, headers-more and friends) are not on it, so they never turn the result into a failure.
Why do I get “looks like it is missing its ;”?
nginx allows a directive to span several lines, so the tool only warns in a very conservative case: the current directive already has arguments and the next line starts with another known directive name. Check whether a semicolon really is missing before changing anything.
Can I validate a whole nginx.conf?
Yes, paste the whole file. You can also paste just a server or location fragment — top-level blocks are then treated as a legal top-level structure instead of complaining about the missing outer http block.
Keywords:nginxnginx confignginx validatornginx syntaxnginx 配置nginx 校验nginx 语法检查locationserver 块upstreammissing semicolon配置文件检查