本文共 1276 字,大约阅读时间需要 4 分钟。
修改Nginx的header伪装服务器,just for fun! 1. #vi nginx-0.7.30/src/core/nginx.h 修改如下: - #define NGINX_VERSION "1.6"
- #define NGINX_VER "LTWS/" NGINX_VERSION
-
- #define NGINX_VAR "NGINX"
- #define NGX_OLDPID_EXT ".oldbin"
复制代码 2. #vi nginx-0.7.30/src/http/ngx_http_header_filter_module.c 将如下: - static char ngx_http_server_string[] = "Server: nginx" CRLF;
复制代码 修改为: - static char ngx_http_server_string[] = "Server: LTWS" CRLF;
复制代码 3. #vi nginx-0.7.30/src/http/ngx_http_special_response.c 将如下: - static u_char ngx_http_error_full_tail[] =
- "<hr><center>" NGINX_VER "</center>" CRLF
- "</body>" CRLF
- "</html>" CRLF
- ;
-
-
- static u_char ngx_http_error_tail[] =
- "<hr><center>nginx</center>" CRLF
- "</body>" CRLF
- "</html>" CRLF
- ;
复制代码 修改为: - static u_char ngx_http_error_full_tail[] =
- "<center> "NGINX_VER" </center>" CRLF
- "<hr><center>http://www.linuxtone.org</center>" CRLF
- "</body>" CRLF
- "</html>" CRLF
- ;
-
-
- static u_char ngx_http_error_tail[] =
- "<hr><center>LTWS</center>" CRLF
- "</body>" CRLF
- "</html>" CRLF
- ;
复制代码 演示效果:[root@snsdbs http]# curl -I http://219.*.*.13/info.php - HTTP/1.1 200 OK
- Server:LTWS/1.6
- Date: Tue, 13 Jan 2009 03:00:22 GMT
- Content-Type: text/html; charset=gb2312
- Connection: keep-alive
- Vary: Accept-Encoding
复制代码 403错误时显示的错误页效果: |
转载于:https://blog.51cto.com/fantefei/901093