原文:http://www.jb51.net/article/79878.htm

首先查看现在环境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 ~]# wget -P /usr/local/src/ http://nginx.org/download/nginx-1.9.7.tar.gz
[root@localhost ~]# cd /usr/local/src/ 
[root@localhost src]# tar -zxvf nginx-1.9.7.tar.gz 
[root@localhost src]# cd nginx-1.9.7

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# ps -ef |grep nginx
root 894 1 0 16:06 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 896 894 0 16:06 ? 00:00:00 nginx: worker process 
nobody 897 894 0 16:06 ? 00:00:00 nginx: worker process

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# ./configure --user=www --group=www --prefix=/usr/local/nginx/ --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# make

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# cp objs/nginx /usr/local/nginx/sbin/

执行升级命令

复制代码代码如下:

[root@localhost nginx-1.9.7]# 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`
sleep 1
test -f /usr/local/nginx//logs/nginx.pid.oldbin
kill -QUIT `cat /usr/local/nginx//logs/nginx.pid.oldbin`

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

复制代码代码如下:

[root@localhost nginx-1.9.7]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.9.7
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx/ --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module

创建www用户

复制代码代码如下:

[root@localhost nginx-1.9.7]# useradd -s /sbin/nologin -M www

查看nginx进程 PID已经更改

复制代码代码如下:

[root@localhost sbin]# ps -ef |grep nginx
root 3814 1 0 16:23 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 3815 3814 0 16:23 ? 00:00:00 nginx: worker process 
nobody 3816 3814 0 16:23 ? 00:00:00 nginx: worker process

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

复制代码代码如下:

[root@localhost conf]# ps -ef |grep nginx
root 3814 1 0 16:23 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www 4200 3814 0 16:48 ? 00:00:00 nginx: worker process 
www 4201 3814 0 16:48 ? 00:00:00 nginx: worker process

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

Nginx1.8.0版本平滑升级新版本1.9.7的更多相关文章

  1. nginx-1.12.0版本(编译安装)-自定义安装路径

    nginx-1.12.0版本(编译安装)-自定义安装路径 安装路径:/application/nginx-1.12.0 1.前期准备 安装编译需要的gcc和gcc-c++ yum install -y ...

  2. nginx1.14.0版本https加密配置

    修改host文件,为最后访问域名准备 C:\Windows\System32\drivers\etc host文件目录192.168.10.140 www.joyce.com 在最后添加这个自定义域名 ...

  3. Nginx版本平滑升级方案

    背景:由于负载均衡测试服务器中nginx版本过低,存在安全漏洞,查询相关修复漏洞资料,需要采取nginx版本升级形式对漏洞进行修复. Nginx平滑升级方案 1.案例采用版本介绍 旧版本 nginx- ...

  4. nginx1.14.0版本高可用——keepalived双机热备

    nginx不支持主从,所以我们需要使用keepalive支持高可用. keepalived重要知识点 在局域网内,每个主机上各安装一个keepalived,注意关闭防火墙firewalld,然后设定一 ...

  5. nginx1.14.0版本location路径配置四种方式

    假设下面四种情况分别用 http://192.168.1.1/proxy/test.html 进行访问. 第一种:location /proxy/ {    proxy_pass http:// 12 ...

  6. nginx1.14.0版本server、location、rewrite配置

    server配置demo 在192.168.10.140(centos7)上修改: /home/program/nginx/conf/nginx.conf 添加一个server server { li ...

  7. nginx1.14.0版本负载均衡配置

    upstream配置: upstream upstream1 { server 192.168.10.130:8080; server 192.168.10.140:8080; #server 192 ...

  8. nginx1.14.0版本location路径,多级文件目录配置,root与alias的配置区别

    1.多级目录配置 多级目录是指像/html/mypage 等等配置: server { listen 80; server_name localhost; location = /page1/ { # ...

  9. Nginx平滑升级详细步骤-113p.cn

    认识平滑升级 有时候我们需要对Nginx版本进行升级以满足运维人员对其功能的需求,例如添加xxx模块,需要xxx功能,而此时Nginx又在跑着业务无法停掉,这时我们就只能平滑升级了. 平滑升级原理 N ...

随机推荐

  1. Linux中top和free命令详解(转)

    top:命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最"敏感"的任务列表. 该命令可以按CPU使用.内存使用和执行时间对任务进行排序: 而且该命令的很多特性都可以通 ...

  2. 《如何阅读一本书》(How to Read a Book)

    值得一读的书,有深入浅出,也有并不能完全读懂的部分,以下是第11章对之前内容的总结整理. 阅读的层次 1. 基础阅读 2. 检视阅读 3. 分析阅读 4. 主题阅读 分析阅读 第一阶段:这本书在谈些什 ...

  3. 近期unity ios接入的事情

    1,  在接入苹果内支付的时候,遇到一个很严重的问题,使用的公司的moni2来测试的,但是在测试的过程中发现每次调用oc的内支付代码后,总会先回调一个支付成功,然后弹出输入密码框,当点击取消后,再一次 ...

  4. Sipdroid实现SIP(五): 用Java实现的UserAgent

    I. 概述 UserAgent是SIP协议中的一个概念, 将"打电话"功能中的主叫和被叫逻辑上封装成UserAgent, 就像将"注册"功能的发起方和接收方封装 ...

  5. [coding horror] 1 - sum 2

    sum 2 描述 输入一个递增排序的数组和一个数字S,在数组中查找两个数,是的他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的. 对应每个测试案例,输出两个数,小的先输出. codi ...

  6. Java学习笔记-Thread-线程

    //2015年5月5日16:55:00 //Main package com.alfredsun.thread; public class Main { public static void main ...

  7. case a.ass_term_unit when '01' then (case a.ass_profit_mode when '0' then round(sum(a.ass_amount*a.ass_annual_rate/365*365*a.ass_term/100) ,2) when '1' then round(sum(a.ass_amount*a.ass_annual_rate/

    --01 年 02 月 03 日 select a.ass_due_date, case a.ass_term_unit when '01' then (case a.ass_profit_mode ...

  8. CoreJavaE10V1P3.7 第3章 Java的基本编程结构-3.7 输入输出(Input ,Output)

    3.7.1 读取输入 Scanner in = new Scanner(System.in); System.out.print("What is your name? "); S ...

  9. VMware虚拟机服务的vmware-hostd自动启动和停止

    安装了虚拟机 任务管理器会出现vmware-hostd.exe  占用了80端口,导致xampp打不开,所以就想关闭vmware,解决方案如下: 开始——运行——services.msc,找到VM打头 ...

  10. java中的反编译

    使用JD-GUI工具  支持mac os 和 windows  地址为:http://jd.benow.ca