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

相关推荐
bukeyiwanshui5 小时前
20260416 DHCP以及DNS
linux·网络
IMPYLH5 小时前
Linux 的 printf 命令
linux·运维·服务器·bash
艾莉丝努力练剑6 小时前
【Linux加餐】mmap文件映射
linux·运维·服务器·c语言·c++·学习
久绊A6 小时前
Linux 跨服务器导出 Docker 容器内文件
linux·docker
DeepHacking6 小时前
Ubuntu 22.04 安装 Allow Locked Remote Desktop 扩展:解决锁屏后 mstsc 无法连接的问题
linux·运维·ubuntu
广州灵眸科技有限公司6 小时前
瑞芯微(EASY EAI)RV1126B QT GUI例程方案
linux·服务器·开发语言·网络·人工智能·qt·物联网
dingdingfish6 小时前
TLPI 第4章 练习:File I/O: The Universal I/O Model
linux·tlpi·exercise
李日灐6 小时前
<3>Linux 基础指令:从时间、查找、文本过滤到 .zip/.tgz 压缩解压与常用热键
linux·运维·服务器·开发语言·后端·面试·指令
hughnz6 小时前
自动化控压钻井系统的挑战与风险
linux·服务器·网络
色空大师6 小时前
【linux开放端口-以8848为例】
linux·运维·服务器·防火墙