漏洞修复:在应用程序中发现不必要的 Http 响应头

描述

blablabla描述,一般是在返回的响应表头中出现了Server键值对,那我们要做的就是移除它,解决方案中提供了nginx的解决方案

解决方案

第一种解决方案

当前解决方案会隐藏nginx的版本号,但还是会返回nginx字样,如果想再彻底点,参考第二种解决方案

bash 复制代码
server{
  server_tokens off;
}

or

bash 复制代码
location{
  server_tokens off;
}

第二种解决方案

当前方法需要安装一个插件,所以nginx需要重新编译一下,也可以拿我编译好的nginx,编译版本是centos7 64位
插件:https://github.com/openresty/headers-more-nginx-module

到nginx官网下载nginx后,在编译时增加--add-module=/path/to/headers-more-nginx-module

记得修改/path/to/headers-more-nginx-module为你下载的插件路径

bash 复制代码
wget 'http://nginx.org/download/nginx-1.17.8.tar.gz'
tar -xzvf nginx-1.17.8.tar.gz
cd nginx-1.17.8/

./configure --prefix=/opt/nginx \
    --add-module=/path/to/headers-more-nginx-module

make
make install

编译完成后,在nginx.conf参数中增加,以移除Server键值对

bash 复制代码
server{
   more_clear_headers  "Server";
   more_clear_headers  "server";
}

参考

编译好的nginx

使用7z压缩的exe文件,解压即可

https://www.aliyundrive.com/s/rGr9YQxuhnM

提取码: 1l0f

nginx server tokens 参数描述:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens

插件地址:https://github.com/openresty/headers-more-nginx-module

相关推荐
诚信爱国敬业友善18 分钟前
GUI编程(window系统→Linux系统)
linux·python·gui
sekaii19 分钟前
ReDistribution plan细节
linux·服务器·数据库
YH_DevJourney1 小时前
Linux-C/C++《C/8、系统信息与系统资源》
linux·c语言·c++
威哥爱编程2 小时前
Linux驱动开发13个实用案例
linux
去看日出2 小时前
Linux(centos)系统安装部署MySQL8.0数据库(GLIBC版本)
linux·数据库·centos
qq_448941082 小时前
10、k8s对外服务之ingress
linux·容器·kubernetes
D-river3 小时前
【如何基于Debian构建Kali Linux】
linux·网络·安全·网络安全
年轮不改3 小时前
ARM-Linux 基础项目篇——简单的视频监控
linux·arm开发
m0_748238784 小时前
Nginx 负载均衡详解
运维·nginx·负载均衡
程序员JerrySUN4 小时前
树莓派 4B:AI 物联网完整部署方案
linux·人工智能·嵌入式硬件·物联网·分类·数据挖掘