nginx 平滑升级

文件上传到/urs/local目录下。
nginx-1.20.1.tar.gz
下载链接:http://nginx.org/en/download.html
执行tar zxvf nginx-1.20.1.tar.gz 解压。
cd /usr/local/nginx-1.20.1
1、查看当前Nginx版本
# /usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
configure arguments: --prefix=/usr/local/nginx

2、配置nginx并编译,切记不要make install
#./configure --prefix=/usr/local/nginx
#make

3、备份原来的nginx文件,使用最新的文件
先看一下文件日期:
# ll /usr/local/nginx/sbin/nginx
#mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

4、使用最新的文件
#cp /usr/local/nginx-1.20.1/objs/nginx /usr/local/nginx/sbin/nginx
再看一下文件日期:
# ll /usr/local/nginx/sbin/nginx

5、升级nginx(提示正常)
# make upgrade
/usr/local/nginx/sbin/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
kill -USR2 cat /usr/local/nginx/logs/nginx.pid
kill: 用法:kill [-s 信号声明 | -n 信号编号 | -信号声明] 进程号 | 任务声明 ... 或 kill -l [信号声明]
make: *** [upgrade] 错误 1

6、查看升级后版本信息(升级成功,且服务不中断)
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.20.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
configure arguments: --prefix=/usr/local/nginx

你可能感兴趣的:(nginx 平滑升级)