一、问题描述
二、修复步骤
[root@VM_0_12_centos conf]# vim nginx.conf
#添加内容
server_tokens off;
浏览器控制台抓包可以看到:
**Response Headers**
Accept-Ranges: bytes
Content-Length: 739
Content-Type: text/html
Date: Tue, 30 Jun 2020 07:53:36 GMT
ETag: "5e9bc167-2e3"
Last-Modified: Sun, 19 Apr 2020 03:11:35 GMT
Server: nginx
修改web服务器所使用的nginx的名称和版本信息
(1)一共需要修改三个文件。包括:
·src/core目录下的nginx.h文件
·src/http目录下的ngx_http_header_filter_module.c文件
·src/http目录下的ngx_http_special_response.c文件
(2)修改内容如下:
[root@VM_0_12_centos core]# vim nginx.h
#define NGINX_VERSION ""
#define NGINX_VER "CSDN" NGINX_VERSION
[root@VM_0_12_centos http]# vim ngx_http_header_filter_module.c
static u_char ngx_http_server_string[] = "Server: CSDN" CRLF;
[root@VM_0_12_centos http]# vim ngx_http_special_response.c
static u_char ngx_http_error_tail[] =
"
CSDN " CRLF
"
" CRLF "