roger2001c 发表于 2018-11-16 11:43:15

nginx隐藏http头

  修改src/core/nginx.h
  #define NGINX_VERSION "1.0.12"
  #define NGINX_VER "nginx/" NGINX_VERSION
  #define NGINX_VAR "NGINX"
  修改src/http/ngx_http_header_filter_module.c
  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"" CRLF"" CRLF;
  vi nginx.conf
  在http 加上 server_tokens off;
  如下:
  http {
  ……省略配置
  sendfile on;
  tcp_nopush on;
  keepalive_timeout 65;
  tcp_nodelay on;
  server_tokens off;
  …….省略配置
  }
  Squid 3.0 STABLE 11
  src/globals.cc:58 改为:
  const char *const full_appname_string = "jufukeji";
  输出 Header:
  HTTP/1.0 400 Bad Request
  Server: jufukeji
  Mime-Version: 1.0
  Date: Mon, 12 Jan 2009 15:25:15 GMT
  Content-Type: text/html
  Content-Length: 1553
  Expires: Mon, 12 Jan 2009 15:25:15 GMT
  X-Squid-Error: ERR_INVALID_URL 0
  X-Cache: MISS from 'cache.hutuworm.org'
  Via: 1.0 'cache.hutuworm.org' (jufukeji)
  Proxy-Connection: close
  Tomcat 6.0.18
  java/org/apache/coyote/http11/Constants.java:56
  java/org/apache/coyote/ajp/Constants.java:236
  均改为:ByteChunk.convertToBytes("Server: jufukeji" + CRLF);
  输出 Header:
  HTTP/1.1 200 OK
  Server: jufukeji
  ETag: W/"7857-1216684872000"
  Last-Modified: Tue, 22 Jul 2008 00:01:12 GMT
  Content-Type: text/html
  Content-Length: 7857
  Date: Mon, 12 Jan 2009 16:30:44 GMT
  Apache 2.2.11
  server/core.c:2784 添加:
  ap_add_version_component(pconf, "jufukeji");
  return;
  输出 Header:
  HTTP/1.1 200 OK
  Date: Mon, 12 Jan 2009 14:28:10 GMT
  Server: jufukeji
  Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
  ETag: "1920edd-2c-3e9564c23b600"
  Accept-Ranges: bytes
  Content-Length: 44
  Content-Type: text/html

页: [1]
查看完整版本: nginx隐藏http头