debian隐藏Apache和PHP版本信息

隐藏 Apache 版本

apache 的 httpd.conf 有两个配置可以控制是否显示服务器信息给用户。
ServerTokens
ServerSignature
默认条件下会把apache版本 系统 模块都显示出来 (HTTP 返回头)
设置为:
ServerTokens ProductOnly
ServerSignature Off
就隐藏Apache的Apache Version信息。
ServerTokens Prod
服务器会发送(比如): Server: Apache
ServerTokens Major
服务器会发送(比如): Server: Apache/2
ServerTokens Minor
服务器会发送(比如): Server: Apache/2.0
ServerTokens Min
服务器会发送(比如): Server: Apache/2.0.41
ServerTokens OS
服务器会发送(比如): Server: Apache/2.0.41 (Unix)
ServerTokens Full (或未指定)
服务器会发送(比如): Server: Apache/2.0.41 (Unix) PHP/4.2.2 MyMod/1.2
如果是debian系统,则是在 /etc/apache2/conf.d/security 里面进行设置。。。
隐藏 PHP 版本
php.ini
expose_php On
改成
expose_php Off
重启apache后,php版本在http头中隐藏了。