nginx基本操作

[b]启动[/b]

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 优雅关闭工作进程

参考:
[1][url]http://wiki.nginx.org/NginxCommandLine[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值