隐藏nginx版本信息

来自Linux78|wiki
Bob讨论 | 贡献2019年11月15日 (五) 17:34的版本 (创建页面,内容为“修改3个位置,一个是nginx.h、另一个是ngx_http_header_filter_module.c、还有一个ngx_http_special_response.c。 一般修改都是在nginx编译之…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

修改3个位置,一个是nginx.h、另一个是ngx_http_header_filter_module.c、还有一个ngx_http_special_response.c。

一般修改都是在nginx编译之前修改,修改完了之后需要重新编译

scr/core/nginx.conf

  1. define NGINX_VER "nginx/" NGINX_VERSION

/src/http/ngx_http_header_filter_module.c (HTTP ResponseHeader) static char ngx_http_server_string[] = "Server: nginx" CRLF; /src/http/ngx_http_special_response.c static u_char ngx_http_error_tail[] =

"


nginx

" CRLF

"</body>" CRLF "</html>" CRLF 隐藏版本号:

修改nginx.conf 在http{}加入

http{

    server_tokens  off;  

}