nginx平滑晋级,0不间断平滑进级到一

By admin in 美高梅手机版4858 on 2019年4月18日

原稿刊载于:20拾-1二-0玖
转载至cu于:2012-07-21

原版的书文刊载于:2010-1贰-0玖
转载至cu于:2012-07-21

Nginx最近有漏洞爆出,于是把原来的nginx-壹.六.二平滑进级至nginx-一.1二.1稳固版。并记录那壹历程,参照这一历程也适用其余版本的晋升。

Nginx一.八.0平滑进级到壹.十.一,不间断服务。

闲来无事把nginx服务器晋级了,因为未有日常玩linux,记录下来避防以往再晋级的时候又去查资料。

闲来无事把nginx服务器晋级了,因为尚未平时玩linux,记录下来防止今后再升格的时候又去查资料。

  1. 始发从前先查看一下脚下选拔的本子。
  1. 先查看当前的版本及原来安装编写翻译时候的参数路径文件消息。
    #/usr/local/nginx/sbin/nginx -V
    nginx version: nginx/1.8.0
    built by gcc 4.1.2 20080704 (Red
    Hat 4.1.2-50)
    built with OpenSSL 1.0.1c 10 May 2012
    TLS SNI support enabled
    configure
     arguments: –user=nginx –group=nginx –prefix=/usr/local/nginx 
    –with-http_ssl_module –with-openssl=-1.0.1c 
    –with-pcre=/soft/pcre-8.21 –with-zlib=/soft/zlib-1.2.8 
    –with-http_stub_status_module –with-threads -l_module 
    –with-http_flv_module –with-http_stub_status_module 
    –with-http_gzip_static_module
    –http-client-bodyar/tmp/nginx/client/ 
    –http-proxy-temp-path=/var/tmp/nginx/proxy/ 
    –http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ 
    temp-path=/var/tmp/nginx/uwsgi –http-scgi-temp-path=/var/tmp/nginx/scgi

下载:

下载:

# /usr/local/webserver/nginx/sbin/nginx -V

※那是原先编写翻译的参数。编辑新本子必要用到。

[root@liuawblizfpws~]#wget 
(版本号已修改)

[root@liuawblizfpws~]#wget 
(版本号已修改)

nginx: nginx version: nginx/1.0.5

2.下载新本子:  解压、编译
# tar -zxvf nginx-1.10.1.tar.gz
# cd nginx-1.10.1

./configure –user=nginx –group=nginx –prefix=/usr/local/nginx 
–with-http_ssl_module –with-openssl=/soft/openssl-1.0.1c 
–with-pcre=/soft/pcre-8.21 –with-zlib=/soft/zlib-1.2.8 
–with-http_stub_status_module –with-threads
–with-http_ssl_module 
–with-http_美高梅手机版4858 ,flv_module –with-http_stub_status_module 
–with-http_gzip_static_module 
–http-client-body-temp-path=/var/tmp/nginx/client/ 
–http-proxy-temp-path=/var/tmp/nginx/proxy/ 
–http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ 
–http-uwsgi-temp-path=/var/tmp/nginx/uwsgi 
–http-scgi-temp-path=/var/tmp/nginx/scgi
# make

解压:

解压:

nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50)

编写翻译安装后方可实施 echo $? 查看是或不是成功,再次回到值为0表达正确。

[root@liuawblizfpws ~]#tar zxvf  nginx-0.*.*.tar.gz
(版本号已修改)

[root@liuawblizfpws ~]#tar zxvf  nginx-0.*.*.tar.gz
(版本号已修改)

nginx: TLS SNI support disabled

  1. 推行完后,不要 make install,重名 /sbin/nginx为nginx.old
    # mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

  2. 复制编写翻译后 objs 目录下的 nginx 文件到 nginx 的装置目录 sbin 下
    # cp objs/nginx /usr/local/nginx/sbin/

  3. 测试一下新复制过来文件生效景况:
    # /usr/local/nginx/sbin/nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is
    ok
    nginx平滑晋级,0不间断平滑进级到一。nginx: configuration file /usr/local/nginx/conf/nginx.conf test is
    successful

  4. 让 nginx 把 nginx.pid 文件修改成 nginx.pid.oldbin,随即运营nginx,完成不间断服务。
    # kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`

那里顺便把nginx的本子号修改了,起到早晚的钦州成效。

此间顺便把nginx的本子号修改了,起到早晚的云浮成效。

nginx: configure arguments: –user=www –group=www
–prefix=/usr/local/webserver/nginx –with-http_stub_status_module
–with-http_ssl_module –with-http_flv_module –with-cc-opt=-O3
–with-cpu-opt=opteron –with-http_gzip_static_module

此时翻开 nginx 进度,能够看出新建立的历程和原先的历程同时存在.

修改源码文件:

修改源码文件:

※ 注意乌紫区域,那是先前编写翻译的参数。立时编辑新本子须要用到。

翻看进程pid文件:
[root@Nginx ~]#cd /usr/local/nginx/logs
[root@Nginx logs]# ls
access.log  error.log  nginx.pid  nginx.pid.oldbin

[root@liuawblizfpws ~]#vim nginx-0.*.*/src/core/nginx.h

#define NGINX_VERSION      “*.$.&”   (版本号)

#define NGINX_VER          “net/” NGINX_VE奥迪Q7SION  (服务器名字)

[root@liuawblizfpws ~]#vim nginx-0.*.*/src/core/nginx.h

#define NGINX_VERSION      “*.$.&”   (版本号)

#define NGINX_VER          “net/” NGINX_VE逍客SION  (服务器名字)

贰.下载新本子:

结束 nginx.pid.oldbin:
# kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`

重复编写翻译以前要求查阅以前的nginx的装置音讯:

再次编写翻译此前须要查阅此前的nginx的装置音信:

git clone git://github.com/vozlt/nginx-module-vts.git
用于prometheus的监控

得了后翻看 nginx 进度,此时可以观望 nginx
进度是新确立的长河,从前的长河已终结。

[root@liuawblizfpws ~]#/usr/local/nginx/sbin/nginx -V

[root@liuawblizfpws ~]#/usr/local/nginx/sbin/nginx -V

然后:解压 > 便在此以前的备选 > 编写翻译

【QUIT 代表处理完当前呼吁后没停歇进度;
  HUP
代表重新加载配置,也正是停业原有进程,并拉开新的劳作经过,不会中断用户访问,可以平滑重启
nginx;
  US中华V1 用于 nginx 日志切换,即重新展开三个日记文件;
  USTucson2 用于平滑升级可实施程序;
  WINCH 从容关闭工作历程】

赢得信息(路线等量齐观):

收获消息(路线天公地道):

# tar zxvf nginx-1.0.5.tar.gz

  1. 提高成功,最终在看一下调升后的本子。
    [root@Nginx~]# nginx -tv
    nginx version: nginx/1.10.1
    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
     
    [root@Nginx ~]# nginx -V
    nginx version: nginx/1.10.1
    built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
    built with OpenSSL 1.0.1c 10 May 2012
    TLS SNI support enabled
    configure
     arguments: –user=nginx –group=nginx –prefix=/usr/local/nginx 
    –with-http_ssl_module –with-openssl=/soft/openssl-1.0.1c 
    –with-pcre=/soft/pcre-8.21 –with-zlib=/soft/zlib-1.2.8 
    –with-http_stub_status_module –with-threads
    –with-http_ssl_module 
    –with-http_flv_module –with-http_stub_status_module 
    –with-http_gzip_static_module 
    –http-client-body-temp-path=/var/tmp/nginx/client/ 
    –http-proxy-temp-path=/var/tmp/nginx/proxy/ 
    –http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ 
    –http-uwsgi-temp-path=/var/tmp/nginx/uwsgi 
    –http-scgi-temp-path=/var/tmp/nginx/scgi
    [root@Nginx ~]#

nginx: configure arguments: –user=www –group=www
–prefix=/usr/local/nginx –with-http_stub_status_module
–with-http_ssl_module

nginx: configure arguments: –user=www –group=www
–prefix=/usr/local/nginx –with-http_stub_status_module
–with-http_ssl_module

# cd nginx-1.0.5

CentOS
7下Nginx服务器的设置配备 
http://www.linuxidc.com/Linux/2017-04/142986.htm

编写翻译,但不安装;在编写翻译目录下的objs目录下的nginx文件正是新的进行文书:

编写翻译,但不安装;在编写翻译目录下的objs目录下的nginx文件就是新的推行文书:

# ./configure 

CentOS上设置Nginx服务器达成虚拟主机和域名重定向 
http://www.linuxidc.com/Linux/2017-04/142642.htm

[root@liuawblizfpws nginx-0.*.*]#./configure –user=www
–group=www –prefix=/usr/local/nginx
–with-http_stub_status_module –with-http_ssl_module

[root@liuawblizfpws nginx-0.*.*]#make

[root@liuawblizfpws nginx-0.*.*]#./configure –user=www
–group=www –prefix=/usr/local/nginx
–with-http_stub_status_module –with-http_ssl_module

[root@liuawblizfpws nginx-0.*.*]#make

–user=www 

CentOS 6.8 安装LNMP环境(Linux+Nginx+MySQL+PHP) 
http://www.linuxidc.com/Linux/2017-04/142880.htm

备份原有nginx文件:

备份原有nginx文件:

–group=www 

Linux下安装PHP环境并布置Nginx扶助php-fpm模块 
http://www.linuxidc.com/Linux/2017-05/144333.htm

[root@liuawblizfpws ~]#mv /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx.old

[root@liuawblizfpws ~]#mv /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx.old

–prefix=/usr/local/webserver/nginx 

Nginx服务的SSL认证和htpasswd认证 
http://www.linuxidc.com/Linux/2017-04/142478.htm

将已经编写翻译好的nginx文件复制到相应的施行路线下:

将已经编写翻译好的nginx文件复制到相应的施行路径下:

–with-http_stub_status_module 

Linux中安装配备Nginx及参数详解 
http://www.linuxidc.com/Linux/2017-05/143853.htm

cp ~/nginx-0.*.*/objs/nginx /usr/local/nginx/sbin/nginx

cp ~/nginx-0.*.*/objs/nginx /usr/local/nginx/sbin/nginx

–with-http_ssl_module 

Nginx日志过滤 使用ngx_log_if不记录特定日志
http://www.linuxidc.com/Linux/2014-07/104686.htm

测试,防止不能平滑晋级:

测试,避防不可能平滑进级:

–with-http_flv_module 

CentOS 7.二下Nginx+PHP+MySQL+Memcache缓存服务器安装配备 
http://www.linuxidc.com/Linux/2017-03/142168.htm

[root@liuawblizfpws ~]#/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

[root@liuawblizfpws ~]#/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

–with-cc-opt=’-O3′ 

CentOS陆.玖编写翻译安装Nginx壹.四.柒 
http://www.linuxidc.com/Linux/2017-06/144473.htm

测试通过则将nginx.pid修改为你nginx.pid.oldbin,同时起步新的nginx:

测试通过则将nginx.pid修改为您nginx.pid.oldbin,同时起步新的nginx:

–with-cpu-opt=opteron 

Nginx
的事无巨细介绍
:请点那里
Nginx
的下载地址
:请点那里

[root@liuawblizfpws ~]#kill -USR2 `cat
/usr/local/nginx/logs/nginx.pid`

[root@liuawblizfpws ~]#kill -USR2 `cat
/usr/local/nginx/logs/nginx.pid`

–with-http_gzip_static_module

正文长久更新链接地址:http://www.linuxidc.com/Linux/2017-07/145396.htm

退出原nginx:

退出原nginx:

# make

美高梅手机版4858 1

[root@liuawblizfpws ~]#kill -QUIT `cat
/usr/loca/nginx/logs/nginx.pid.oldbin`

[root@liuawblizfpws ~]#kill -QUIT `cat
/usr/loca/nginx/logs/nginx.pid.oldbin`

  1. 奉行完后,那里并非在 make install
    了,接下去重名/sbin/nginx为nginx.old

查验:

查验:

# mv /usr/local/webserver/nginx/sbin/nginx
/usr/local/webserver/nginx/sbin/nginx.old

[root@liuawblizfpws ~]#curl -I netonline.me

HTTP/1.1 200 OK

Server: net/*.$.&

Date: Thu, 09 Dec 2010 05:13:36 GMT

[root@liuawblizfpws ~]#curl -I netonline.me

HTTP/1.1 200 OK

Server: net/*.$.&

Date: Thu, 09 Dec 2010 05:13:36 GMT

  1. 复制编写翻译后objs目录下的nginx文件到nginx的装置目录sbin/下

# cp objs/nginx /usr/local/webserver/nginx/sbin/

  1. 测试一下新复制过来文件生效意况:

# /usr/local/webserver/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf
syntax is ok

nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf
test is successful

六.
让nginx把nginx.pid文件修改成nginx.pid.oldbin,随即运营nginx,完成不间断

# kill -USR2 `cat /usr/local/webserver/nginx/nginx.pid`  更新配备文件

# kill -QUIT `cat /usr/local/webserver/nginx/nginx.pid.oldbin`
优雅的关门

  1. 进级成功了,最终在看一下晋级后的本子

# /usr/local/webserver/nginx/sbin/nginx -v

nginx: nginx version: nginx/1.12.1

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图
Copyright @ 2010-2019 美高梅手机版4858 版权所有