Nginx隐藏服务器端各类信息的方法
有时我们不希望有人可以通过一些工具来返回我们服务器的信息,下面我来介绍在nginx中隐藏nginx响应头,修改nginx返回头信息,隐藏php版本号,隐藏服务器信息,同学可参考。
首先隐藏nginx版本信息,只需编辑nginx.conf文件
添加一行
server_tokensoff;
http{
include/etc/nginx/mime.types;
default_typeapplication/octet-stream;
indexindex.phpindex.htmlindex.htm;
server_tokensoff;
log_formatmain'$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.logmain;
sendfileon;
#tcp_nopushon;
keepalive_timeout65;
#gzipon;
include/etc/nginx/conf.d/*.conf;
}
响应头隐藏PHP版本休息,编辑php.ini文件找到expose_php=On,修改为expose_php=Off
;;;;;;;;;;;;;;;;; ;Miscellaneous; ;;;;;;;;;;;;;;;;; ;DecideswhetherPHPmayexposethefactthatitisinstalledontheserver ;(e.g.byaddingitssignaturetotheWebserverheader).Itisnosecurity ;threatinanyway,butitmakesitpossibletodeterminewhetheryouusePHP ;onyourserverornot. ;http://www.php.net/manual/en/ini.core.php#ini.expose-php expose_php=Off
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短