1.隐藏nginx的版本号和server信息
[root@node2 nginx-1.8.0]# vim src/http/ngx_http_special_response.c
static u_char ngx_http_error_tail[] =
"<hr><center>tingyun</center>" CRLF --修改定义的名字
"</body>" CRLF
"</html>" CRLF
[root@node2 nginx-1.8.0]# vim src/http/ngx_http_header_filter_module.c
static char ngx_http_server_string[] = "Server: tingyun" CRLF;
[root@node2 nginx-1.8.0]# vim src/core/nginx.h
#define NGINX_VERSION ""
#define NGINX_VER "tingyun/" NGINX_VERSION
#define NGINX_VAR "tingyun"
[root@node2 nginx-1.8.0]# ./configure --prefix=/usr/local/nginx-1.8.0 --user=www --group=www --with-poll_module --with-threads --with-file-aio --with-http_sub_module --with-pcre=/usr/local/pcre-8.37 --with-http_stub_status_module --编译
[root@node2 nginx-1.8.0]# make && make install
2.隐藏varnish的版本信息
[root@node2 varnish]# vim default.vcl --添加如下内容
sub vcl_deliver {
unset resp.http.Via; --默认是显示版本信息(unset 是取消显示)
unset resp.http.X-Varnish;
set resp.http.Server="no-server"; --设置后端服务器版本信息(unset 就是取消)
}
[root@node2 varnish]# /etc/init.d/varnish restart
Stopping Varnish Cache: [ OK ]
Starting Varnish Cache: [ OK ]
[root@node2 varnish]#