ITeye博客

nginx基本操作

wutao8818 · 2011-09-07 11:11 · server · nginx · 开源软件 · Markdown

启动

1、基本启动 /usr/bin/nginx

2、高级启动 /usr/bin/nginx -t -c ~/mynginx.conf -g "pid /var/run/nginx.pid; worker_processes 2;"

可选项:

-c </path/to/config>

Specify which configuration file Nginx should use instead of the default.指定启动的配置文件

-g Set global directives. (version >=0.7.4)

设置全局指令

-t Don't run, just test the configuration file. nginx checks configuration for correct syntax and then try to open files referred in configuration.

测试配置文件是否可用正常启动

-s signal Send signal to a master process: stop, quit, reopen, reload. (version >= 0.7.53)

发送信号。包括停止,退出,重新开启,重新加载。

-v Print version.打印版本信息

-V Print nginx version, compiler version and configure parameters. 打印完整版本信息

-p prefix Set prefix path (default: /usr/local/nginx/). (version >= 0.7.53) 设置前缀路径

-h,-? Print help.

帮助。

如何重启?

有2种方法控制使它停止。

1、/usr/bin/nginx -s stop

2、kill -QUIT $( cat /usr/local/nginx/logs/nginx.pid )

send the 'QUIT' (Graceful Shutdown)

主进程可处理以下信号:

The master process can handle the following signals:

TERM, INT Quick shutdown 快速关闭 QUIT Graceful shutdown 优雅关闭 KILL Halts a stubborn process 中止难以停止的进程 HUP Configuration reload 配置重新加载 Start the new worker processes with a new configuration 以新的配置文件启动新的进程 Gracefully shutdown the old worker processes 优雅关闭老进程 USR1 Reopen the log files 重新打开新的日志文件 USR2 Upgrade Executable on the fly 升级可执行
WINCH Gracefully shutdown the worker processes 优雅关闭工作进程

参考: http://wiki.nginx.org/NginxCommandLine

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。