在Linux系統的伺服器上隱藏PHP版本號碼的方法

來源:互聯網
上載者:User

   這篇文章主要介紹了在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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.