nginx配置热更新
启动
将配置文件设置好,然后执行相应的文件,启动程序。
- windows
直接执行可执行文件
- linux的supervisor配置(后台启动)
/home/nginx/sbin/nginx -g ‘daemon off;‘ -c /home/nginx/conf/nginx.conf -p /home/nginx
-s 命令
To start nginx, run the executable file. Once nginx is started, it can be controlled by invoking the executable with the -s parameter. Use the following syntax:
nginx -s signal
Where signal may be one of the following:
- stop — fast shutdown
- quit — graceful shutdown
- reload — reloading the configuration file
- reopen — reopening the log files
简而言之,就是这些信号命令,只能在nginx启动后才可能执行成功。
配置热更新
先判断nginx时候正在运行:
supervisorctl status|grep nginx|grep RUNNING if [ $? -eq 0 ];then /home/nginx/sbin/nginx -s reload -c /home/nginx/conf/nginx.conf -p /home/nginx fi
若是nginx未运行,执行配置热更新命令,会提示:nginx.pid不存在。这个文件中,记录着nginx的pid。这个也可以用作判断nginx是否运行。
相关推荐
nginxs 2020-11-14
Guanjs0 2020-11-13
小木兮子 2020-11-11
yserver 2020-11-11
ssihc0 2020-11-11
windle 2020-11-10
HanksWang 2020-11-10
liuchen0 2020-11-10
Freshairx 2020-11-10
ccschan 2020-11-10
liwf 2020-11-10
Guanjs0 2020-11-09
AderStep 2020-11-09
zrtlin 2020-11-09
mqfcu 2020-11-10
windle 2020-10-29