nginx简单重启、测试配置文件方法
时间:2016-10-06 19:19 来源:linux.it.net.cn 作者:it.net.cn
nginx配置做了修改,运行一段时间或者安装了新的程序,都需要重启,网上的很多教程都需要使用脚本或者是
kill -HUP $pid($pid就是nginx master进程的进程号)
研究了一下nginx帮助后发现,有-s参数可对nginx服务进行管理:
# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/
Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file
这样执行
# /usr/local/nginx/sbin/nginx -s reload
nginx已经重启成功
同样我们可以通过测试配置文件是否正确
# /usr/local/nginx/sbin/nginx -t
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
配置文件正确
(责任编辑:IT)
nginx配置做了修改,运行一段时间或者安装了新的程序,都需要重启,网上的很多教程都需要使用脚本或者是 kill -HUP $pid($pid就是nginx master进程的进程号)
研究了一下nginx帮助后发现,有-s参数可对nginx服务进行管理:
Options:
这样执行 同样我们可以通过测试配置文件是否正确
# /usr/local/nginx/sbin/nginx -t 配置文件正确 (责任编辑:IT) |