Command-Line Parameters

Beginner
4 min read
Updated: Nov 2026
3 examples
CLI

Definition

The nginx binary accepts flags to test config, pick a file, show version info, and send control signals to a running master process.

Memorize four: -t (test), -s reload (apply), -c (config path), -V (version and build flags).

Config

Start with this shape. Adjust paths for your server.

Nginx
nginx -t
nginx -s reload
nginx -c /etc/nginx/nginx.conf
nginx -V

On package installs you often prefix with sudo. The signal forms need a running master that owns the PID file.

Key Directives

NamePlain meaning
-tTest configuration and exit.
-TTest and dump the full config (including includes).
-s signalstop, quit, reopen, or reload.
-c fileUse this configuration file.
-VShow version, compiler options, and SNI status.
-g directivesPass 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

  1. -t reads the config without changing workers.
  2. Fix errors until the test is successful.
  3. 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

  1. -T still tests syntax.
  2. Includes are expanded in the dump.
  3. 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

  1. -v is the short string.
  2. -V shows modules and paths used at build time.
  3. Look for TLS SNI support enabled when debugging HTTPS name-based hosts.

Frequently Asked Questions

stop (fast shutdown), quit (graceful), reopen (logs), reload (config).
Nginx is not running, or the PID file path does not match this binary's config.
When the config is not in the default path, or you maintain several nginx.conf files.
Yes. It only validates; it does not replace workers until you reload.
systemctl starts the service unit. nginx -s talks to an already running master. Both are commonly used together.

Next: Nginx introduction

Keep going through the beginner Nginx path.

Nginx introduction →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful