Nginx平滑升级

阅读更多

1,查看当前版本:

> /usr/sbin/nginx -V
nginx version: nginx/1.10.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx (此处省略一大堆) --with-mail

 

2,下载最新版本,并解压

> wget http://101.96.10.64/nginx.org/download/nginx-1.11.3.tar.gz
> tar -xvf nginx-1.11.3.tar.gz

 

3,配置编译

> ./configure 加上步骤1中的configure arguments值
> make

 

4,备份原nginx文件为nginx.old,拷贝新的nginx文件

 

5,平滑升级

> ps -ef | grep nginx
root     30438     1  0 7月18 ?       00:00:00 nginx: master process /usr/sbin/nginx
nginx    50975 30438  0 14:41 ?        00:00:00 nginx: worker process
root     59228 45924  0 16:42 pts/0    00:00:00 grep --color=auto nginx

> kill -USR2 30438
> ps -ef | grep nginx
root     30438     1  0 7月18 ?       00:00:00 nginx: master process /usr/sbin/nginx
nginx    50975 30438  0 14:41 ?        00:00:00 nginx: worker process
root     59230 30438  0 16:42 ?        00:00:00 nginx: master process /usr/sbin/nginx
nginx    59231 59230  0 16:42 ?        00:00:00 nginx: worker process
root     59344 45924  0 16:46 pts/0    00:00:00 grep --color=auto nginx

 

6,关闭旧的容器,或者旧进程完成后会自动退出,可以不用关闭

> kill –WINCH 30438

 

 

 

你可能感兴趣的:(Nginx平滑升级)