nginx平滑升级
[root@localhost 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
[root@localhost logs]# wget https://codeload.github.com/openresty/headers-more-nginx-module/zip/master -O ./headers-more-nginx-module-master.zip
[root@localhost soft]# unzip headers-more-nginx-module-master.zip
[root@localhost nginx-1.11.10]# make clean
rm -rf Makefile objs
[root@localhost logs]# ./configure --prefix=/soft/nginx --add-module=/soft/headers-more-nginx-module-master
make && make install
[root@localhost 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
[root@localhost logs]# kill -s WINCH `cat /soft/nginx/logs/nginx.pid.oldbin`
[root@localhost 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
[root@localhost logs]# ls
access.log error.log nginx.pid nginx.pid.oldbin
[root@localhost logs]# kill -s QUIT `cat /soft/nginx/logs/nginx.pid.oldbin`
[root@localhost 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 删除