Linux服務(wù)器中怎樣隱藏PHP版本
web server避免一些不必要的麻煩,可以把apache和php的版本信息不顯示,那么Linux服務(wù)器中怎樣隱藏PHP版本呢?下文學(xué)習(xí)啦小編就分享了Linux服務(wù)器中隱藏PHP版本的方法,希望對大家有所幫助。
Linux服務(wù)器中隱藏PHP版本方法
默認(rèn)上expose_php默認(rèn)是開的。關(guān)閉“expose_php”參數(shù)可以使php隱藏它的版本信息。
[root@centos66 ~]# vi /etc/php.ini
在你的php.ini, 定位到含有expose_php的那行把On設(shè)成Off:
expose_php = Off
在此之前,web服務(wù)器頭看上去就像這樣:
[root@centos66 ~]# curl -I http://www.ehowstuff.com/ 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 服務(wù)后,php就不會在web服務(wù)頭中顯示版本了:
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
LCTT譯注:除了 PHP 的版本之外,Web 服務(wù)器也會默認(rèn)泄露版本號。如果使用 Apache 服務(wù)器,請參照此文章關(guān)閉Apache 版本顯示;如果使用 Nginx 服務(wù)器,請在 http 段內(nèi)加入server_tokens off; 配置。以上修改請記得重啟相關(guān)服務(wù)。
相關(guān)文章:
1. 如何雙啟動Win11和Linux系統(tǒng)?Win11 和 Linux雙系統(tǒng)安裝教程2. Linux中的僵尸進(jìn)程如何產(chǎn)生的?僵尸進(jìn)程怎么殺?3. Linux Kernel 4.14版怎么樣?Linux Kernel 4.14版介紹4. Linux bash:./xxx:無法執(zhí)行二進(jìn)制文件報錯5. Linux與grub查看各分區(qū)設(shè)備名稱命令是什么6. Linux比Windows更易受外星人入侵7. Speedtest測速怎么看?Linux Speedtest測試方法8. Linux系統(tǒng)如何安裝使用ProcDump for Linux?9. linux下分區(qū)id如何修改10. 干貨分享:Linux命令大全
