1.隐藏版本号,在Nginx主配置文件中http部分添加server_tokens off;即可
[root@Web_server ~]# vim /usr/local/nginx/conf/nginx.conf
http
{
server_tokens off;
}
2.修改软件名,修改源码中下面标红部分,重新编译即可
[root@Web_server src]# cd nginx-1.6.2
[root@Web_server nginx-1.6.2]# vim src/core/nginx.h
#define NGINX_VERSION "8.8.8"
#define NGINX_VER "SZK/" NGINX_VERSION
#define NGINX_VAR "SZK"
[root@Web_server nginx-1.6.2]# vim src/http/ngx_http_header_filter_module.c
static char ngx_http_server_string[] = "Server: SZK" CRLF;
[root@Web_server nginx-1.6.2]# vim src/http/ngx_http_special_response.c
"" NGINX_VER " (http://szk5043.top)" CRLF
"
[root@Web_server ~]# vim /usr/local/nginx/conf/nginx.conf
http
{
server_tokens off;
}
2.修改软件名,修改源码中下面标红部分,重新编译即可
[root@Web_server src]# cd nginx-1.6.2
[root@Web_server nginx-1.6.2]# vim src/core/nginx.h
#define NGINX_VERSION "8.8.8"
#define NGINX_VER "SZK/" NGINX_VERSION
#define NGINX_VAR "SZK"
[root@Web_server nginx-1.6.2]# vim src/http/ngx_http_header_filter_module.c
static char ngx_http_server_string[] = "Server: SZK" CRLF;
[root@Web_server nginx-1.6.2]# vim src/http/ngx_http_special_response.c
"" NGINX_VER " (http://szk5043.top)" CRLF
"
编辑回复