在Linux系统的服务器上隐藏PHP版本号的方法_PHP教程
Jul 13, 2016 am 09:51 AM在Linux系统的服务器上隐藏PHP版本号的方法
这篇文章主要介绍了在Linux系统的服务器上隐藏PHP版本号的方法,有助于预防攻击者针对PHP详细版本的漏洞而发起的攻击,需要的朋友可以参考下
通常,大多数默认设置安装的web服务器存在信息泄露,这其中之一就是PHP。PHP 是如今流行的服务端html嵌入式语言(之一?)。在如今这个充满挑战的时代,有许多攻击者会尝试发现你服务端的漏洞。因此,我会简单描述如何在Linux服务器中隐藏PHP信息。
默认上expose_php默认是开的。关闭“expose_php”参数可以使php隐藏它的版本信息。
?
1 |
[root@centos66 ~]# vi /etc/php.ini |
在你的php.ini, 定位到含有expose_php的那行把On设成Off:
?
1 |
expose_php = Off |
在此之前,web服务器头看上去就像这样:
?
1 |
[root@centos66 ~]# curl -I http://www.ehowstuff.com/ |
?
1 2 3 4 5 6 7 8 9 |
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服务头中显示版本了:
?
1 2 3 4 5 6 7 8 9 |
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 |

Article chaud

Outils chauds Tags

Article chaud

Tags d'article chaud

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Sujets chauds

Guide d'installation et de mise à niveau de PHP 8.4 pour Ubuntu et Debian

Entrée de la version Web Deepseek Entrée du site officiel Deepseek

Comment configurer Visual Studio Code (VS Code) pour le développement PHP

Comment analysez-vous et traitez-vous HTML / XML dans PHP?

Programme PHP pour compter les voyelles dans une chaîne

Installation officielle du site officiel de Bitget (Guide du débutant 2025)

Le package d'installation OUYI OKX est directement inclus
