漏洞修复:在应用程序中发现不必要的 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

相关推荐
一颗青果5 小时前
HTTP协议详解
linux·网络·网络协议·http
Joy T7 小时前
【AI运维】02 云上基础部署:ECS、OSS 与 Nginx 的体系化理解与实践
运维·nginx
Dreamboat-L8 小时前
云服务器上部署nginx
java·服务器·nginx
广州灵眸科技有限公司8 小时前
瑞芯微(EASY EAI)RV1126B CAN使用
linux·网络·单片机·嵌入式硬件
魂万劫10 小时前
如何在虚拟机VM上|Linux环境内安装windows
linux·运维·服务器·windows
季__末10 小时前
WSL2安装配置
nginx
序属秋秋秋10 小时前
《Linux系统编程之进程控制》【进程等待】
linux·c语言·c++·进程·系统编程·进程控制·进程等待
zfj32111 小时前
top 命令中的 wa (IO wait) 指标,理论上几乎完全是由磁盘IO(包括swap)引起的,而不是网络IO
linux·网络·top·iowait
Xの哲學11 小时前
Linux网卡注册流程深度解析: 从硬件探测到网络栈
linux·服务器·网络·算法·边缘计算
用户61354114601611 小时前
libicu-62.1-6.ky10.x86_64.rpm 安装步骤详解(麒麟V10系统)
linux