目录
一.简介
说明
Nginx版本迭代迅速,新版本提供了很多功能,好在Nginx支持不停服务进行升级。
版本之间差距不要太大,不然会导致很多东西不支持
环境
[nginx-server]
主机名:host-1
系统:centos-7.3
地址:1.1.1.1
软件:
nginx-1.8.1 80
nginx-1.10.3 80
二.安装
1.查看当前状态
查看当前版本,有哪些模块,将模块复制粘贴
[root@nginx ~]# nginx -V
2.下载新版本
[root@nginx ~]# yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
[root@nginx ~]# wget http://nginx.org/download/nginx-1.10.3.tar.gz
[root@nginx ~]# tar -xf nginx-1.10.3.tar.gz
[root@nginx ~]# cd nginx-1.10.3
3.升级
先./configure 再make,不要install,否则覆盖
如果发现1.10不支持老版本的模块,那就删除不要添加那个模块了
[root@nginx ~]# ./configure --xx --xx
[root@nginx ~]# make
4.替换
当前目录objs目录下一个nginx文件,那就是nginx -V时的命令
将旧的备份
[root@nginx ~]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
复制心动的
[root@nginx ~]# cp objs/nginx /usr/local/nginx/sbin/
三.使用验证
1.移动到脚本目录
[root@nginx ~]# cd /usr/local/nginx/sbin/
2.检查配置文件
[root@nginx ~]# nginx -t
3.平滑重启nginx
[root@nginx ~]# nginx -s reload
4.检查版本和模块信息,防止有遗漏
[root@nginx ~]# nginx -V