Nginx隱藏服務(wù)器端各類信息的方法
有時(shí)我們不希望有人可以通過(guò)一些工具來(lái)返回我們服務(wù)器的信息,下面我來(lái)介紹在nginx中隱藏nginx響應(yīng)頭,修改nginx返回頭信息,隱藏php版本號(hào),隱藏服務(wù)器信息,同學(xué)可參考。
首先隱藏nginx版本信息,只需編輯 nginx.conf 文件
添加一行
server_tokens off; http { include /etc/nginx/mime.types; default_type application/octet-stream; index index.php index.html index.htm; server_tokens off; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; }
響應(yīng)頭隱藏PHP版本休息,編輯php.ini文件找到expose_php = On , 修改為 expose_php = Off
;;;;;;;;;;;;;;;;; ; Miscellaneous ; ;;;;;;;;;;;;;;;;; ; Decides whether PHP may expose the fact that it is installed on the server ; (e.g. by adding its signature to the Web server header). It is no security ; threat in any way, but it makes it possible to determine whether you use PHP ; on your server or not. ; http://www.php.net/manual/en/ini.core.php#ini.expose-php expose_php = Off
相關(guān)文章
Nginx通過(guò)geo模塊設(shè)置白名單的例子
今天小編就為大家分享一篇Nginx通過(guò)geo模塊設(shè)置白名單的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-08-08利用Nginx_geo模塊實(shí)現(xiàn)CDN調(diào)度的配置方法
今天小編就為大家分享一篇利用Nginx_geo模塊實(shí)現(xiàn)CDN調(diào)度的配置方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-08-08Nginx 路由轉(zhuǎn)發(fā)和反向代理location配置實(shí)現(xiàn)
本文主要介紹了Nginx 路由轉(zhuǎn)發(fā)和反向代理location配置實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-11-11Nginx開(kāi)源可視化配置工具NginxConfig使用教程
這篇文章主要為大家介紹了Nginx開(kāi)源可視化配置工具NginxConfig使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-06-06Nginx配置多臺(tái)機(jī)器實(shí)現(xiàn)負(fù)載均衡的教程詳解
這篇文章主要為大家詳細(xì)介紹了Nginx配置多臺(tái)機(jī)器實(shí)現(xiàn)負(fù)載均衡的相關(guān)教程,文中的示例代碼簡(jiǎn)潔易懂,有需要的小伙伴可以跟隨小編一起學(xué)習(xí)一下2024-03-03