Command-line parameters

nginx supports the following command-line parameters:

  • -? | -h — print help for command-line parameters.

  • -c file — use an alternative configuration file instead of a default file.

  • -g directives — set global configuration directives, for example,

nginx -g "pid /var/run/; worker_processes `sysctl -n hw.ncpu`;"
  • -p prefix — set nginx path prefix, i.e. a directory that will keep server files (default value is /usr/local/nginx ).

  • -q — suppress non-error messages during configuration testing.

  • -s signal — send a signal to the master process. The argument signal can be one of:

  • stop — shut down quickly

    • quit — shut down gracefully

    • reload — reload configuration, start the new worker process with a new configuration, gracefully shut down old worker processes.

    • reopen — reopen log files

  • -t — test the configuration file: nginx checks the configuration for correct syntax, and then tries to open files referred in the configuration.

  • -T — same as -t , but additionally dump configuration files to standard output (1.9.2).

  • -v — print nginx version.

  • -V — print nginx version, compiler version, and configure parameters.