命令行参数

Nginx 支持下列命令行参数:

  • -? | -h — 打印命令行参数的帮助。
  • -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/nginx.pid; 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 — 打印 Nginx 版本。
  • -V — 打印 Nginx 版本、编译器版本、及配置参数。