通过修改nginx源码来修改nginx返回的默认的server信息。
修改前的代码和响应头中的server信息:
代码文件路径:nginx-1.21.4\src\http\ngx_http_header_filter_module.c
static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
修改后的代码和响应头中的server信息:
static u_char ngx_http_server_string[] = "Server: parasaga" CRLF;
static u_char ngx_http_server_full_string[] = "Server: parasaga" CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF;
修改前的代码和默认页面中的server信息:
代码文件路径:nginx-1.21.4\src\http\ngx_http_special_response.c
static u_char ngx_http_error_full_tail[] =
"
" NGINX_VER "" CRLF
"
" CRLF "