search
Homephp教程php手册隐藏apache和php的版本信息配置方法

隐藏apache和php的版本信息配置方法

Jun 13, 2016 am 11:35 AM
apachephpwebinformationandmethodVersionofConfigurationhide

隐藏apache和php的版本信息,web server避免一些不必要的麻烦,可以把apache和php的版本信息不显示

隐藏 Apache 版本信息

/etc/apache2/apache2.conf 或 /etc/httpd/conf/httpd.conf

ServerTokens ProductOnly
ServerSignature Off

重启 apache
现在 http 头里面只看到:
Server: Apache

隐藏 PHP 版本
php.ini

expose_php On
改成
expose_php Off

重启apache后,php版本在http头中隐藏了。

详解 :

为了防止某些别有用心的家伙窥视我们的服务器,应该做些什么.
我们来看一下相关的2个参数,分别为ServerTokens和ServerSignature,通过控制这2个阀门应该就能起到一些作用,比如我们可以在配置文件中这么写:
ServerTokens Prod
ServerSignature Off

ServerTokens
用于控制服务器是否相应来自客户端的请求,向客户端输出服务器系统类型或内置模块等重要的系统信息。 在主配置文件中提供全局控制默认阀值为"Full"(ServerTokens Full),所以,如果你的Linux发行版本没有更改过这个阀值的话,所有与你的系统有关的敏感信息都会向全世界公开。比如RHEL会将该 阀值更改为"ServerTokens OS",而Debian依然使用默认的"Full"阀值
以apache-2.0.55为例,阀值可以设定为以下某项(后面为相对应的Banner Header):
Prod >>> Server: Apache
Major >>> Server: Apache/2
Minor >>> Server: Apache/2.0
Minimal >>> Server: Apache/2.0.55
OS >>> Server: Apache/2.0.55 (Debian)
Full (or not specified) default >>> Server: Apache/2.0.55 (Debian) PHP/5.1.2-1+b1 mod_ssl/2.0.55 OpenSSL/0.9.8b

ServerSignature
控制由系统生成的页面(错误信息,mod_proxy ftp directory listing等等)的页脚中如何显示信息。

可在全局设置文件中控制,或是通过.htaccess文件控制
默认为"off"(ServerSignature Off),有些Linux发行版本可能会打开这个阀门,比如Debian在默认的虚拟主机上默认将这个阀门设置为开放
全局阀门的阀值会被虚拟主机或目录单位的配置文件中的阀值所覆盖,所以,必须确保这样的事情不应该发生 .
 
 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools