commands

nginx — Validate web-server configuration

Check configuration syntax and referenced files without starting the service. Use a private prefix and a trusted standalone configuration. Use a fresh private workspace; system service changes are VM-only.

Formal Syntax & Structure

linux syntaxlinux
nginx -t -p PREFIX -c CONFIG

Parameters & Attributes

NameTypeDescription
-toptionTest configuration
-poptionPrivate prefix
-coptionConfiguration path

Return Value

exit status and output

The -t operation reports syntax/file-access validation, normally on stderr; 0 indicates successful validation and nonzero rejection. It does not start a service or test HTTP responses.

Working Example

Example Snippetlinux
python3 local_hosting.py nginx-check
Linux Reference