nginx -t with a valid configuration?nginx -t after editing the configuration file and it is valid. What output do you expect?nginx -t reports when the config is correct.The nginx -t command checks the syntax of the configuration file. If the config is valid, it outputs a success message indicating syntax is ok and test is successful.
nginx -t show for a missing semicolon?/etc/nginx/nginx.conf. What error message will nginx -t display?When a semicolon is missing, nginx reports an emergency error about unexpected end of file expecting a semicolon or closing brace, and the test fails.
nginx -t fail with 'unknown directive' error?bad_directive in your nginx config and ran nginx -t. It failed with an 'unknown directive' error. What is the most likely cause?An 'unknown directive' error means nginx does not recognize the directive name. This usually happens if the directive is misspelled or belongs to a module not installed or enabled.
systemctl reload nginx to avoid downtime?Running nginx -t tests the configuration syntax and catches errors before reloading. This prevents nginx from failing to reload and causing downtime.
The safe workflow is: first edit the config, then test it with nginx -t. If the test passes, reload nginx to apply changes. Finally, check nginx status to ensure it is running correctly.