Nginx1.8.0版本平滑升级新版本1.9.7

nginx
这篇文章主要介绍了Nginx1.8.0版本平滑升级新版本1.9.7的相关资料,需要的朋友可以参考下

 首先查看现在环境nginx的版本为1.8.0 编译的参数只指定了安装路径;

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

平滑升级步骤如下:

下载nginx1.9.7版本,解压并进入解压后的目录

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

编译安装之前查看nginx进程ID信息:

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

编译安装:指定用户www 支持ssl 支持pcre 支持状态查询 支持静态压缩模块;

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

编译安装后可以echo $?查看是否成功,成功后只需要执行make,不需要make install;

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

平滑升级,先移走现有的nginx二进制文件

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

拷贝新生成的nginx二进制文件到指定目录

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

执行升级命令

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

查看版本,发现已经是1.9.7版本,编译的参数也存在;

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

创建www用户

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

查看nginx进程 PID已经更改

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

修改nginx.conf配置文件,更改用户和用户组为www用户,保存退出,重启nginx服务;

[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --prefix=/usr/local/nginx

Nginx1.8.0版本平滑升级新版本1.9.7就给大家介绍到这里,希望对大家有所帮助!