Nginx—— 12.升级

1. 查看原程序的编译参数
[root@node2 ~]# nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/share/nginx/nginx1.16.1 --with-http_ssl_module --with-http_stub_status_module 
2. 备份
[root@node2 ~]# cd /share/nginx/
[root@node2 nginx]# ls
nginx
[root@node2 nginx]# cp -rp nginx  nginx-bak
3.下载
[root@node2 soft]# wget http://nginx.org/download/nginx-1.17.8.tar.gz
[root@node2 soft]# tar xvf nginx-1.17.8.tar.gz 
[root@node2 soft]# cd nginx-1.17.8
#不make install
[root@node2 nginx-1.17.8]# ./configure --prefix=/share/nginx/nginx --with-http_ssl_module --with-http_stub_status_module && make 
4.编译覆盖

复制编译make后的文件nginx,覆盖正在执行的原来的nginx文件

[root@node2 nginx-1.17.8]# pwd
/share/soft/nginx-1.17.8
[root@node2 nginx-1.17.8]# cd objs/
[root@node2 objs]# ls
autoconf.err  Makefile  nginx  nginx.8  ngx_auto_config.h  ngx_auto_headers.h  ngx_modules.c  ngx_modules.o  src
[root@node2 objs]# cp nginx /share/nginx/nginx/
client_body_temp/ fastcgi_temp/     logs/             sbin/             uwsgi_temp/       
conf/             html/             proxy_temp/       scgi_temp/        
[root@node2 objs]# cp nginx /share/nginx/nginx/sbin/nginx 
cp: overwrite ‘/share/nginx/nginx/sbin/nginx’? y
5.新旧交替

使旧版nginx停止就收请求,新版nginx接替

[root@node2 nginx]# pwd
/share/nginx/nginx
[root@node2 nginx]# find . -iname *.pid
./logs/nginx.pid
[root@node2 nginx]# kill -USR2 `cat ./logs/nginx.pid`
[root@node2 nginx]# nginx -t
nginx: the configuration file /share/nginx/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /share/nginx/nginx/conf/nginx.conf test is successful
[root@node2 nginx]# nginx -s reload

————Blueicex 2020/2/27 17:29 blueice1980@126.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值