LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nginx

web server and reverse proxy

TLDR

Start nginx
$ nginx
copy
Test configuration
$ nginx -t
copy
Reload configuration
$ nginx -s reload
copy
Stop nginx
$ nginx -s stop
copy
Graceful shutdown
$ nginx -s quit
copy
Show version
$ nginx -v
copy
Test config and dump it to stdout
$ nginx -T
copy
Use specific config
$ nginx -c [/etc/nginx/nginx.conf]
copy
Set global directives at startup
$ nginx -g "[daemon off;]"
copy

SYNOPSIS

nginx [-?hqtTvV] [-s signal] [-p prefix] [-e filename] [-c filename] [-g directives]

DESCRIPTION

nginx ("engine x") is a high-performance HTTP and reverse proxy server, as well as a mail (IMAP/POP3/SMTP) proxy server. It is designed to handle a large number of concurrent connections with a low, predictable memory footprint using an event-driven, asynchronous architecture.Running nginx with no arguments starts the server (in the foreground or as a daemon, depending on the configuration). Once running, the master process is controlled at runtime by sending signals with -s rather than by restarting. Changes to the configuration are applied with `nginx -s reload`, which starts new worker processes and gracefully shuts down the old ones.Beyond serving static files, nginx is widely used as a reverse proxy, load balancer, TLS terminator, and HTTP cache in front of application servers.

PARAMETERS

-?, -h

Print help for command-line parameters.
-t
Test the configuration file: nginx checks the syntax and then tries to open files referenced in the configuration.
-T
Same as -t, but additionally dump the configuration files to standard output (1.9.2+).
-q
Suppress non-error messages during configuration testing.
-s SIGNAL
Send a signal to the master process. The signal may be one of: stop (fast shutdown), quit (graceful shutdown), reload (reload configuration), or reopen (reopen log files).
-p PREFIX
Set the path prefix, that is, a directory that will keep server files. Default is /usr/local/nginx.
-e FILE
Use an alternative error log file. The special value stderr logs to standard error (1.19.5+).
-c FILE
Use an alternative configuration file instead of the default prefix/conf/nginx.conf.
-g DIRECTIVES
Set global configuration directives, for example `nginx -g "pid /var/run/nginx.pid;"`.
-v
Print the nginx version.
-V
Print the nginx version, compiler version, and configure parameters.

CAVEATS

Behavior is driven entirely by the configuration file; always validate changes with -t before reloading. Paths printed in help and defaults are relative to the compile-time prefix and often differ on distribution packages (commonly /etc/nginx/nginx.conf).

HISTORY

nginx was created by Igor Sysoev and first publicly released in 2004 to solve the C10k problem of handling many simultaneous connections. It is now developed by F5, Inc. and powers a large share of the busiest sites on the web.

SEE ALSO

apache2(8), caddy(1), haproxy(1)

Copied to clipboard
Kai