现在重新编译 Nginx ,平滑更新:
[root@z-dig ~]# cd /usr/local/src/nginx
 [root@z-dig nginx]# make clean
 rm -rf Makefile objs
 [root@z-dig nginx]#./configure --prefix=/usr/local/nginx --user=www --group=www 
 –with-http_ssl_module --with-http_stub_status_module 
 –add-module=/usr/local/src/headers-more-nginx-module-master
 [root@z-dig nginx]# make
 [root@z-dig nginx]# make install
 [root@z-dig nginx]# kill -s USR2 cat /usr/local/nginx/logs/nginx.pid [root@z-dig nginx]# ps -ef|grep nginx
 root 2017 1 0 Apr21 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
 www 2018 2017 0 Apr21 ? 00:00:30 nginx: worker process
 root 21717 2017 0 19:41 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
 www 21718 21717 0 19:41 ? 00:00:00 nginx: worker process
 root 21856 18312 0 19:45 pts/2 00:00:00 grep nginx
 [root@z-dig nginx]# kill -s WINCH cat /usr/local/nginx/logs/nginx.pid.oldbin [root@z-dig nginx]# ps -ef|grep nginx
 root 2017 1 0 Apr21 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
 root 21717 2017 0 19:41 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
 www 21718 21717 0 19:41 ? 00:00:00 nginx: worker process
 root 21943 18312 0 19:49 pts/2 00:00:00 grep nginx
 [root@z-dig nginx]# kill -s QUIT cat /usr/local/nginx/logs/nginx.pid.oldbin [root@z-dig nginx]# ps -ef|grep nginx
 root 21717 1 0 19:41 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
 www 21718 21717 0 19:41 ? 00:00:00 nginx: worker process
 root 22050 18312 0 19:54 pts/2 00:00:00 grep nginx
 [root@z-dig nginx]#
到此 Nginx 已重新编译并平滑升级成功。


 在 Nginx 的配置文件中加入代码,将之前请求网站返回 Header 中的 X-Powered-By 和 WP-Super-Cache 删除:
more_clear_headers ‘X-Powered-By’;
 more_clear_headers ‘WP-Super-Cache’;
[root@z-dig ~]# 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@z-dig ~]# nginx -s reload
再次请求查看效果:
[root@KVM ~]# curl -I www.z-dig.com
 HTTP/1.1 200 OK
 Server: www.z-dig.com
 Date: Sat, 23 Apr 2016 12:03:04 GMT
 Content-Type: text/html; charset=UTF-8
 Connection: keep-alive
 Vary: Accept-Encoding, Cookie
 Cache-Control: max-age=3, must-revalidate[root@KVM ~]#