隐藏nginx版本信息
来自Linux78|wiki
修改3个位置,一个是nginx.h、另一个是ngx_http_header_filter_module.c、还有一个ngx_http_special_response.c。
一般修改都是在nginx编译之前修改,修改完了之后需要重新编译
scr/core/nginx.conf
- 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[] =
"
" CRLF
"</body>" CRLF "</html>" CRLF 隐藏版本号:
修改nginx.conf 在http{}加入
http{
server_tokens off;
}