问题描述
我在我的 etc/apache2.conf 文件中添加了这两行,它隐藏了操作系统和 apache 版本.
I have added these 2 lines in my etc/apache2.conf file, and it hid the OS and apache version.
ServerSignature Off
ServerTokens Prod
但毕竟我可以看到带有服务器名称的标题
But after all I can see the header with server name
Server Apache
如何隐藏这些信息?我使用的是 Debian 7,apache v 2.2
How to hide this information as well ?I am using Debian 7, apache v 2.2
谢谢
推荐答案
Apache 本身无法完全取消设置服务器标头(即使使用 mod_headers 也不行).
Apache on its own cannot completely unset the Server header (not even with mod_headers).
这 似乎是设计使然,正如 Apache 所讨论的开发人员.
This appears to be by design, as discussed by the Apache devs.
有一种方法可以使用 ModSecurity 做到这一点,但我对此知之甚少.相反,这些人已经想通了:
There is a way to do this using ModSecurity, but I know little about that. Instead, these people have it all figured out already:
https://unix.stackexchange.com/questions/124137/change-apache-httpd-server-http-header
我可以验证这是否有效,只是在 Debian 7.6 上试过.
I can verify that this works, just tried on Debian 7.6.
为 apache 安装 mod security,然后将其添加到您的 apache2.conf
中.
edit:install mod security for apache and then add this in your apache2.conf
.
<IfModule security2_module>
SecRuleEngine on
ServerTokens Full
SecServerSignature " "
</IfModule>
重启apache后,Server header会消失
After this restarting the apache, Server header will disappear
这篇关于完全隐藏服务器名称 apache的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!