隐藏Apache的版本号

来源:互联网 发布:广告ios软件 编辑:程序博客网 时间:2024/05/16 01:47

最近在用Django搞一个小玩意,但又担心被别人笑话,于是留了个心眼,将Django部署到Apache上,然后wget看看有无要紧消息(用-S,--spider返回头信息):


HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Thu, 16 Sep 2010 14:07:14 GMT
  Server: Apache/2.2.16 (Unix) mod_wsgi/3.3 Python/2.6.5
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Content-Type: text/xml;charset=gbk
Length: unspecified [text/xml]
200 OK

 

这可不得了,如若让Django的仇家知道,岂非会被误杀?

 

上网google半响,找到一个mod_headers,支持关闭/增加/设置任一http头,于是在httpd.conf里增加一条命令:

 

Header unset Server

 

但是不管用,尝试了一下unset Connection,结果里果然没了Connection这个头,也就是说Header unset对Server无用。

岂有此理,又不是圣斗士?于是查了一下,原来很久以前就有人报告这个问题了

https://issues.apache.org/bugzilla/show_bug.cgi?id=40026

开发人员用此名句回复:It's not a bug, but a feature

不过改哥们可能也不太好意思,还是提供了一个折中方案,用ServerTokens命令:

 

ServerTokens Prod

 

这次再看看Http回复头:

 

HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Thu, 16 Sep 2010 14:29:39 GMT
  Server: Apache
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Content-Type: text/xml;charset=gbk
Length: unspecified [text/xml]
200 OK

 

虽然还是可能被Apache的仇家追杀,但是...就这样吧

 

今天真是充实的一天啊。

原创粉丝点击