Command-line parameters命令行参数
nginx supports the following command-line parameters:nginx支持以下命令行参数:
-?
|-h
—print help for command-line parameters.打印命令行参数的帮助。-c
—file
use an alternative configuration使用替代配置文件而不是默认文件。file
instead of a default file.-e
—file
use an alternative error log使用备用错误日志文件来存储日志,而不是默认文件(1.19.5)。file
to store the log instead of a default file (1.19.5).The special value特殊值stderr
selects the standard error file.stderr
选择标准错误文件。-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设置nginx路径前缀,即保存服务器文件的目录(默认值为/usr/local/nginx
)./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:参数signal可以是以下之一: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.测试配置文件:nginx检查配置的语法是否正确,然后尝试打开配置中引用的文件。-T
—same as与-t
, but additionally dump configuration files to standard output (1.9.2).-t
相同,但另外将配置文件转储到标准输出(1.9.2)。-v
—print nginx version.打印nginx版本。-V
—print nginx version, compiler version, and configure parameters.打印nginx版本、编译器版本和配置参数。