修改Nginx的header伪装服务器,just for fun!

1.
#vi nginx-0.7.30/src/core/nginx.h  修改如下:
  1. #define NGINX_VERSION      "1.6"
     
  2. #define NGINX_VER          "LTWS/" NGINX_VERSION
     

  3.  
  4. #define NGINX_VAR          "NGINX"
     
  5. #define NGX_OLDPID_EXT     ".oldbin"
复制代码
2.
#vi nginx-0.7.30/src/http/ngx_http_header_filter_module.c
将如下:
  1. static char ngx_http_server_string[] = "Server: nginx" CRLF;
复制代码
修改为:
  1. static char ngx_http_server_string[] = "Server: LTWS" CRLF;
复制代码
3.
#vi nginx-0.7.30/src/http/ngx_http_special_response.c
将如下:
  1. static u_char ngx_http_error_full_tail[] =
     
  2. "<hr><center>" NGINX_VER "</center>" CRLF
     
  3. "</body>" CRLF
     
  4. "</html>" CRLF
     
  5. ;
     

  6.  

  7.  
  8. static u_char ngx_http_error_tail[] =
     
  9. "<hr><center>nginx</center>" CRLF
     
  10. "</body>" CRLF
     
  11. "</html>" CRLF
     
  12. ;
复制代码
修改为:
  1. static u_char ngx_http_error_full_tail[] =
     
  2. "<center> "NGINX_VER" </center>" CRLF
     
  3. "<hr><center>http://www.linuxtone.org</center>" CRLF
     
  4. "</body>" CRLF
     
  5. "</html>" CRLF
     
  6. ;
     

  7.  

  8.  
  9. static u_char ngx_http_error_tail[] =
     
  10. "<hr><center>LTWS</center>" CRLF
     
  11. "</body>" CRLF
     
  12. "</html>" CRLF
     
  13. ;
复制代码
演示效果:[root@snsdbs http]# curl -I http://219.*.*.13/info.php
  1. HTTP/1.1 200 OK
     
  2. Server:LTWS/1.6
     
  3. Date: Tue, 13 Jan 2009 03:00:22 GMT
     
  4. Content-Type: text/html; charset=gb2312
     
  5. Connection: keep-alive
     
  6. Vary: Accept-Encoding
复制代码
403错误时显示的错误页效果:
403.JPG
2009-1-13 11:03:14 上传
下载附件 (6.9 KB)