脚本宝典收集整理的这篇文章主要介绍了Nginx隐藏服务器端各类信息的方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
有时我们不希望有人可以通过一些工具来返回我们服务器的信息,下面我来介绍在nginx中隐藏nginx响应头,修改nginx返回头信息,隐藏phP版本号,隐藏服务器信息,同学可参考。
首先隐藏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; }
响应头隐藏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
以上是脚本宝典为你收集整理的Nginx隐藏服务器端各类信息的方法全部内容,希望文章能够帮你解决Nginx隐藏服务器端各类信息的方法所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。