nginx: configuration test failed (unexpected "}", missing ";")
Last reviewed 2026-09-19
nginx's configuration is a tree of blocks in braces and directives ending in semicolons. A missing semicolon or a brace that is opened but not closed makes the whole file fail its test, and the error usually names a line a little after the real mistake.
Messages you might see
- “nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:42”
- “nginx: [emerg] unexpected end of file, expecting ";" or "}"”
- “nginx: configuration file test failed”
Why it happens
- A directive that does not end with a semicolon.
- An extra or missing closing brace after editing a server or location block.
- A multi-line value or quoted string that was not closed.
Try this first (free, no tool needed)
- Run `nginx -t` and read the line number, then look at the directive above that line.
- Check the last edited block for a missing semicolon or brace.
- Keep a copy of the working config and compare changes with `diff`.
If that didn't work
These tools run in your browser. Your file is read and repaired on your own device and is never uploaded.
Nginx Config Checker
Checks the structure of an nginx configuration: adds missing semicolons and closing braces, removes stray ones, respects strings, comments and multi-line values and can re-indent by depth. It checks structure only, not whether directives are valid for your nginx version.
Open Nginx Config CheckerCommon questions
Does it validate my directives?
No. Use nginx -t on your server for that. The tool fixes the structural mistakes that stop the test from getting that far.
Is my file uploaded anywhere?
No. The tool runs as a program inside your own browser, so the file is read and repaired on your device and never sent to a server.