nginx平滑升级

Posted pluto2charon

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx平滑升级相关的知识,希望对你有一定的参考价值。

[[email protected] sbin]# ./nginx -V

nginx version: nginx/1.11.10

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) 

configure arguments: --prefix=/soft/nginx

[[email protected] logs]# wget https://codeload.github.com/openresty/headers-more-nginx-module/zip/master -O ./headers-more-nginx-module-master.zip

[[email protected] soft]# unzip headers-more-nginx-module-master.zip 

[[email protected] nginx-1.11.10]# make clean

rm -rf Makefile objs

[[email protected] logs]# ./configure --prefix=/soft/nginx --add-module=/soft/headers-more-nginx-module-master

make && make install

[[email protected] logs]# kill -s USR2 `cat /soft/nginx/logs/nginx.pid`

root      17105      1  0 17:30 ?        00:00:00 nginx: master process ./nginx

nobody    17106  17105  0 17:30 ?        00:00:00 nginx: worker process

root      19788  17105  0 17:35 ?        00:00:00 nginx: master process ./nginx

nobody    19789  19788  0 17:35 ?        00:00:00 nginx: worker process

root      19791  12252  0 17:35 pts/5    00:00:00 grep --color=auto nginx

[[email protected] logs]# kill -s WINCH `cat /soft/nginx/logs/nginx.pid.oldbin`

[[email protected] logs]# ps -ef | grep nginx

root      17105      1  0 17:30 ?        00:00:00 nginx: master process ./nginx

root      19788  17105  0 17:35 ?        00:00:00 nginx: master process ./nginx

nobody    19789  19788  0 17:35 ?        00:00:00 nginx: worker process

root      19826  12252  0 17:38 pts/5    00:00:00 grep --color=auto nginx

[[email protected] logs]# ls

access.log  error.log  nginx.pid  nginx.pid.oldbin

[[email protected] logs]# kill -s QUIT `cat /soft/nginx/logs/nginx.pid.oldbin`

[[email protected] logs]# ps -ef | grep nginx

root      19788      1  0 17:35 ?        00:00:00 nginx: master process ./nginx

nobody    19789  19788  0 17:35 ?        00:00:00 nginx: worker process

root      19830  12252  0 17:38 pts/5    00:00:00 grep --color=auto nginx

到此 Nginx 已重新编译并平滑升级成功。

在 Nginx 的配置文件中加入代码,将之前请求网站返回 Header 中的 X-Powered-By 和 WP-Super-Cache 删除

 

以上是关于nginx平滑升级的主要内容,如果未能解决你的问题,请参考以下文章

nginx平滑升级

使用 Nginx 实现平滑升级

Nginx 的平滑升级

Nginx 的平滑升级

nginx的平滑升级

openresty开发系列3--nginx的平滑升级