nginx配置热更新


启动

将配置文件设置好,然后执行相应的文件,启动程序。

  1. windows

直接执行可执行文件

  1. 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是否运行。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM