Configuration guides

Trace a missing Nginx semicolon to its source line

·

Start with the first structure finding and look at the directive immediately before it. A closing brace may be the first point where a missing semicolon's effect becomes clear.

Nginx Validator

Read both findings in the worked example

Select Load example and Check structure. Line 3, column 1 points to the closing brace. The line above is worker_connections 128, which needs a semicolon.

Line 4, column 1 points to include. Its supplied arguments are conf.d/site.conf and extra. The core include form takes one file or glob and ends with a semicolon.

Read both findings in the worked example
LocationFindingEdit
3:1Directive ends at a closing braceAdd ; after 128
4:1Include has extra argumentsRemove extra

Nginx configuration syntaxNginx core include and events directives

Check the repaired text and export the report

Add the semicolon, remove extra and select Check structure again. The output shows Structure passed with three directives and one block.

Download nginx-structure-report.json. The diagnostics array is empty and includes is 1. The include path is still a reference in the source. The report has no result for its target file.

Nginx core include and events directivesNginx 1.28 configuration tokenizer

Use the target installation for the remaining checks

A text check can locate unclosed quotes, mismatched braces and certain directive forms. The target installation determines the available modules and directive behavior.

Nginx documents the -t mode for checking configuration and trying to open referenced files. Use your controlled installation to account for the intended files, permissions and loaded modules.

Nginx command-line optionsNginx core include and events directives

Common questions

Which line gets reported for an unclosed quote?

The finding points to the opening quote, so you can locate the argument whose boundary was lost.

Can the browser check prove a module-specific directive is installed?

The check understands the configuration structure. Whether a directive is available depends on the modules in your Nginx build.

Sources

Put it into practice.

Related guides