<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post//</link>
<title><![CDATA[修改Nginx的header伪装服务器]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[服务器类]]></category>
<pubDate>Sun, 15 May 2011 18:13:33 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//</guid> 
<description>
<![CDATA[ 
	有时候为了伪装自己的真实服务器环境.<br/>不想让对方知道自己的webserver真实环境,就不得不修改我们的webserer软件了!<br/>今天看了一下baidu.com的webserver感觉像是nginx修改的.<br/>C:&#92;curl-7.18.0&#92;curl.exe -I www.baidu.com<br/>HTTP/1.1 200 OK<br/>Date: Tue, 11 Mar 2008 05:00:39 GMT<br/>Server: BWS/1.0<br/>Content-Length: 3022<br/>Content-Type: text/html<br/>Cache-Control: private<br/>Expires: Tue, 11 Mar 2008 05:00:39 GMT<br/>Set-Cookie: BAIDUID=41BB2845D3E8BC1AEE99D4CECB90C50A:FG=1; expires=Tue, 11-<br/>8 05:00:39 GMT; path=/; domain=.baidu.com<br/>P3P: CP=&quot; OTI DSP COR IVA OUR IND COM &quot;<br/> <br/>于是自己翻了一下nginx源码了,发现竟然很容修改就可以实现.<br/>cd /usr/local/src/nginx-0.5.35/src/core/<br/>[root@zyatt core]# cat nginx.h<br/>/*<br/> * Copyright (C) Igor Sysoev<br/> */ <br/><br/>#ifndef _NGINX_H_INCLUDED_<br/>#define _NGINX_H_INCLUDED_<br/> <br/><br/>#define NGINX_VERSION &quot;1.0&quot;<br/>#define NGINX_VER &quot;LPKWS/&quot; NGINX_VERSION<br/> <br/>#define NGINX_VAR &quot;LPKWS&quot;<br/>#define NGX_OLDPID_EXT &quot;.oldbin&quot; <br/><br/>#endif /* _NGINX_H_INCLUDED_ */<br/> <br/>测试效果<br/>C:&#92;curl-7.18.0&#92;curl.exe -I 211.100.11.122/info.php (此Nginx没有做优化,配置expires,gzip等,仅为测试) <br/><br/>HTTP/1.1 200 OK<br/>Server: LPKWS/1.0<br/>Date: Tue, 11 Mar 2008 04:53:02 GMT<br/>Content-Type: text/html<br/>Transfer-Encoding: chunked<br/>Connection: keep-alive<br/>Keep-Alive: timeout=20<br/>X-Powered-By: PHP/5.2.4<br/>要想更彻底点，把下面这几个文件也修改了<br/>修改src/http/ngx_http_header_filter_module.c<br/>static char ngx_http_server_string[]=&quot;Server: nginx&quot; CRLF;<br/>修改src/http/ngx_http_special_response.c<br/>static u_char ngx_http_error_tail[]=&quot;&lt;hr&gt;&lt;center&gt;nginx&lt;/center&gt;&quot; CRLF&quot;&lt;/body&gt;&quot; CRLF&quot;&lt;/html&gt;&quot; CRLF;<br/>修改Nginx的FastCGI配置文件fastcgi.conf<br/>fastcgi_param&nbsp;&nbsp;SERVER_SOFTWARE&nbsp;&nbsp;&nbsp;&nbsp;nginx/$nginx_version;<br/> <br/>要想真正的优化和安全考虑,还是应该好好读读源代码,踏踏实实做好细节工作!<br/>Tags - <a href="http://www.zhanghaijun.com/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.zhanghaijun.com/tags/header/" rel="tag">header</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post//#blogcomment</link>
<title><![CDATA[[评论] 修改Nginx的header伪装服务器]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>