ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

nginx平滑升级(1.14--1.15)

2019-04-23 19:41:50  阅读:279  来源: 互联网

标签:1.14 1.15 http module nginx root localhost


  • 查看旧版nginx编译参数
[root@localhost yum.repos.d]# nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_modu
le --with-http_gzip_static_module

[root@localhost yum.repos.d]# ps aux | grep nginx
root      80809  0.0  0.1  47024  1912 ?        Ss   12:10   0:00 nginx: master process nginx
nginx     80810  0.0  2.2  69760 22652 ?        S    12:10   0:00 nginx: worker process
nginx     80811  0.0  2.2  69760 22652 ?        S    12:10   0:00 nginx: worker process
  • 备份旧版本

    [root@localhost yum.repos.d]# strings /usr/local/nginx/sbin/nginx.old

  • 安装新版本的nginx(不要执行make install)
[root@localhost ~]# tar zxf nginx-1.15.9.tar.gz -C /usr/src/
[root@localhost nginx-1.15.9]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module && make
#和nginx -V 查看的所编译的要相同

[root@localhost nginx-1.15.9]# cp objs/nginx /usr/local/nginx/sbin/nginx
#使用新的二进制文件代替旧的

[root@localhost nginx-1.15.9]# 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@localhost nginx-1.15.9]# nginx -V
#如一切环境正常,可以看到版本号已经修改为新的了
  • 发送USR2信号
[root@localhost nginx-1.15.9]# kill -USR2 80809
#向主进程(master)发送 USR2 信号,Nginx 会启动一个新版本的master进程和对应工作进程,和旧版一起处理请求

[root@localhost nginx-1.15.9]# ps aux | grep nginx

[root@localhost ~]# kill -WINCH 80809
#向旧的 Nginx 主进程(master)发送 WINCH信号,它会逐步关闭自己的工作进程(主进程不退出),这时所有请求都会由新版 Nginx 处理

[root@localhost ~]# kill -QUIT 80809
#向旧的 Nginx 主进程(master)发送(QUIT、TERM、或者 KILL)信号,使旧的主进程退出

[root@localhost nginx-1.15.9]# nginx -v
nginx version: nginx/1.15.9
#测试查看版本号

over……

标签:1.14,1.15,http,module,nginx,root,localhost
来源: https://www.cnblogs.com/joinbestgo/p/10758430.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有