usually Nginx server does not hide server type and version informationCurl-i http://www.aaa.com Get the type and version code of the Web server http/1.1 OK server:nginx nginx/0.8.53 date:tue, Dec 2010 08:10:06 GMT content-type:text/html content-length:151 Last-modified:mon, Dec 09:39:55 GMT connection:keep-alive Accept-ranges:bytes
This is a hidden danger for server security and can be improved in the following ways1. Edit the source code: /SRC/HTTP/NGX_HTTP_HEADER_FILTER_MODULE.C Modify the former code to the static char ngx_http_server_string[] = "Server:nginx" CRLF; "Ngx_http_server_full_string[" = "Server:" Nginx_ver CRLF; Change the code to static char ngx_http_server_string[] = "Server:test 1.0" CRLF; [ngx_http_server_full_string[] = "Server:test 1.0" Nginx_ver CRLF;
then compile the installation. 2. Edit/usr/local/nginx/conf/nginx.conf, add server_tokens off;
re-start Nginx/usr/local/nginx/sbin/nginx-s Reload the final result is as follows Curl-i http://www.aaa.com modified server information Code http/1.1 OK server:test 1.0 Date:tue, Dec 08:24:32 GMT content-type:text/html content-length:151 Last-modified:mon, 2010 09:39: GMT connection:keep-alive Accept-ranges:bytes
Modify Nginx Server Type