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
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下