在默认情况下,系统会把Apache版本模块都显示出来(在http返回头中)。
在隐藏apache版本号之前:
[root@localhost ~]# curl -I www.ihaocn.com
HTTP/1.1 200 OK
Date: Tue, 27 Dec 2016 12:58:36 GMT
Server: Apache/2.2.15 (CentOS)
Link: <http://www.ihaocn.com/wp-json/>; rel=”https://api.w.org/”
Connection: close
Content-Type: text/html; charset=UTF-8
在隐藏apache版本号之后:
[root@localhost ~]# curl -I www.ihaocn.com
HTTP/1.1 200 OK
Date: Tue, 27 Dec 2016 12:59:11 GMT
Server: Apache
Link: <http://www.ihaocn.com/wp-json/>; rel=”https://api.w.org/”
Connection: close
Content-Type: text/html; charset=UTF-8
操作方法:
编辑 /etc/httpd/conf/httpd.conf 配置文件。
找到 ServerTokens
并把 ServerTokens OS 修改为 ServerTokens Prod
找到 : ServerSignature
并把 ServerSignature On 修改为 ServerSignature Off
修改完成,保存。 然后重启apache。