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

相关推荐
Uncertainty!!2 小时前
Ubuntu 22.04 安装超好用中文输入法rime-ice(雾凇拼音)过程记录
linux·ubuntu·中文输入法
ShineWinsu3 小时前
对于Linux:网络基础的解析
linux·网络·面试·udp·笔试·ip·tcp
↘"LYong4 小时前
旧版 CentOS 安装 Docker 完整指南(附国内镜像加速)
linux·运维·docker
Zhang~Ling5 小时前
Vim 多模式详解:命令、插入、底行与插件配置
linux·编辑器·vim
想你依然心痛6 小时前
Linux用户空间与内核空间通信:netlink、ioctl、mmap 零拷贝与性能对比
linux·运维·服务器
做个文艺程序员7 小时前
Linux第12篇:性能监控与瓶颈分析——CPU/内存/IO/网络全维度
linux·运维·网络
HAPPY酷8 小时前
【ROS2】 Conda 环境搭建(命令行版)
linux·运维·python·ubuntu·机器人·conda
hai3152475439 小时前
九章空间几何对照直译法:通用芯片 / 定制专用芯片 编译适配规则
linux·汇编·bash
没头脑的男大9 小时前
CMake学习教学
linux·c++·学习
ton_tom9 小时前
设备驱动程序编程-Linux2.6.10-kdb安装-32位
linux·运维·服务器