网页发送到header信息中包括了当前页面的基本信息,其中便有环境版本号及php版本号等信息。 HTTP/1.1 200 OK Server: nginx/1.5.0 Date: Wed, 23 May 2018 15:31:15 GMT Content-Type: text/html; charset=utf-8 Connection: close Vary: Accept-Encoding X-Powered-By: PHP/5.3.1 这个发送出去的头部信息就会暴露出nginx版本号和php的版本号,一般情况影响不大,但这样就让别人知道自己的服务器环境了,始终不太好。下面就说说如何设置环境达到隐藏这些信息的目的。 一、隐藏nginx版本号:修改nginx配置文件nginx.conf,查找: server_tokens on; 改为: server_tokens off; 二、隐藏apache版本号:修改apache配置文件httpd.conf,查找: ServerTokens Prod ServerSignature On 改为: ServerTokens Prod ServerSignature Off 三、隐藏php版本号:修改php配置文件php.ini,查找: expose_php = On 改为: expose_php = Off 修改后输出的header信息: HTTP/1.1 200 OK Server: nginx Date: Wed, 23 May 2018 15:31:15 GMT Content-Type: text/html; charset=utf-8 Connection: close Vary: Accept-Encoding |
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.