一、nginx的平滑升级
所谓平滑升级,就是在不影响当前程序运行的情况下,对Nginx版本进行升级、添加/删除服务器模块。
步骤:
- 下载nginx新版本软件,正常执行./configure 和make 但不要执行make install
- 备份原程序
- 拷贝新程序
- 获取当前nginx主进程pid
- 升级新程序
- 关闭原worker进程但保留主进程:为了回退
我们将nginx1.20.1平滑升级至1.20.2
恢复原程序
[root@server1 ~]# nginx -s stop
[root@server1 ~]# cd /usr/local/nginx
[root@server1 nginx]# cd conf
[root@server1 conf]# vim nginx.conf
[root@server1 conf]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@server1 conf]# cd ..
[root@server1 nginx]# cd sbin
[root@server1 sbin]# ls
nginx nginx.old
[root@server1 sbin]# mv nginx nginx.new
[root@server1 sbin]# ls
nginx.new nginx.old
[root@server1 sbin]# rm -f nginx.new
[root@server1 sbin]# ls
nginx.old
[