On package installs you often prefix with sudo. The signal forms need a running master that owns the PID file.
Key Directives
Name
Plain meaning
-t
Test configuration and exit.
-T
Test and dump the full config (including includes).
-s signal
stop, quit, reopen, or reload.
-c file
Use this configuration file.
-V
Show version, compiler options, and SNI status.
-g directives
Pass global directives from the command line.
Examples
Example 1 — Test Before Reload
Catch syntax errors early.
Nginx
sudo nginx -t
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
# nginx: configuration file /etc/nginx/nginx.conf test is successful
sudo nginx -s reload
How It Works
-t reads the config without changing workers.
Fix errors until the test is successful.
Then reload to apply.
Example 2 — Dump the Effective Config
When includes get confusing, -T prints everything Nginx would use.
Nginx
sudo nginx -T | less
How It Works
-T still tests syntax.
Includes are expanded in the dump.
Great for debugging which file set a directive.
Example 3 — Check Build Options
See the version and whether TLS SNI support is enabled.
Nginx
nginx -v # short version
nginx -V # version + configure arguments
How It Works
-v is the short string.
-V shows modules and paths used at build time.
Look for TLS SNI support enabled when debugging HTTPS name-based hosts.