nginx平滑升级
一、实验环境
操作系统版本:CentOS 7.6
nginx版本:nginx 1.6.3 nginx 1.10.3
二、安装nginx 1.6.3
1.下载nginx安装包
[root@localhost ~]# wget http://nginx.org/download/nginx-1.6.3.tar.gz
2.安装依赖包
[root@localhost ~]# yum install gcc gcc-c++ pcre pcre-devel zlib zlib-devel -y
3.解压压缩包
[root@localhost ~]# tar xf nginx-1.6.3.tar.gz
4.编译安装
[root@localhost ~]# cd nginx-1.6.3/
[root@localhost nginx-1.6.3]# ./configure
[root@localhost nginx-1.6.3]# make && make install
5.查看版本
[root@localhost ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.6.3
三、安装nginx1.10.3
1.下载nginx安装包
[root@localhost ~]# wget http://nginx.org/download/nginx-1.10.3.tar.gz
2.解压压缩包
[root@localhost ~]# tar xf nginx-1.10.3.tar.gz
3.编译安装
[root@localhost ~]# cd nginx-1.10.3/
[root@localhost nginx-1.10.3]# ./configure
[root@localhost nginx-1.10.3]# make
4.复制启动文件
[root@localhost nginx-1.10.3]# cp /root/nginx-1.10.3/objs/nginx /usr/local/nginx/sbin/
cp:是否覆盖"/usr/local/nginx/sbin/nginx"? y
四、平滑升级
1.平滑升级
[root@localhost nginx-1.10.3]# 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
2.查看版本
[root@localhost nginx-1.10.3]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.3
总结:
此时发现版本已经更新了,这样就完成了nginx的在线平滑升级。