通常,大多数预设设定安装的 web 站群服务器存在资讯泄露,这其中之一就是 PHP 。 PHP 是如今流行的服务端 html 嵌入式语言(之一?)。在如今这个充满挑战的时代,有许多攻击者会尝试发现你服务端的漏洞。因此,我会简单描述如何在 Linux 站群服务器中隐藏 PHP 资讯。
预设上 expose_php 预设是开的。关闭 “expose_php” 引数可以使 php 隐藏它的版本资讯。

[root@centos66 ~]# vi /etc/php.ini

在你的 php.ini, 定位到含有 expose_php 的那行把 On 设成 Off:

expose_php = Off

在此之前,web 站群服务器头看上去就像这样:

[root@centos66 ~]# curl -I http://www.ehowstuff.com/

HTTP/1.1 200 OK
Server: nginx
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
X-Powered-By: PHP/5.3.3
X-Pingback: http://www.ehowstuff.com/xmlrpc.php
Date: Wed, 11 Feb 2015 14:10:43 GMT
X-Page-Speed: 1.9.32.2-4321
Cache-Control: max-age=0, no-cache

更改并重启 Web 服务后,php 就不会在 web 服务头中显示版本了:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 11 Feb 2015 15:38:14 GMT
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
X-Pingback: http://www.ehowstuff.com/xmlrpc.php
Date: Wed, 11 Feb 2015 14:10:43 GMT
X-Page-Speed: 1.9.32.2-4321
Cache-Control: max-age=0, no-cache