解决appscan扫描“下在应用程序中发现不必要的 Http 响应头”问题

解决appscan扫描“下在应用程序中发现不必要的 Http 响应头”问题


问题原因:配置服务器以除去向所有外发请求发送的缺省“Server”头。也就是说我们送的请求头出现了 server:nginx 1.1.1这些信息。


说明:要想整个隐藏掉server整个信息,网上搜到的资料windows系统是无法实现。所以我这里也是用centos弄得。


解决方法
注:centos系统安装好的基础上操作
一.nginx的安装
1.下载 nginx

 $ cd /home   # 进入指定目录,目录请自行选择
 $ wget https://nginx.org/download/nginx-1.21.2.tar.gz  # 下载安装包,版本请自行选择

2.cd 至 nginx 安装包所在目录,进行解压;
    

$ cd /home   # 进入安装包所在目录
$ tar -zxvf nginx-1.21.2.tar.gz   # 解压


3.cd 至解压后的目录,运行./configure 进行初始化配置; 注:如果初始化配置有问题的话,需要安装依赖包,没有的跳过一下安装内容
 

   $ cd ./nginx-1.21.2   # 进入解压目录
   $ ./configure   # 运行./configure  

    安装内容 

    # 提示 error: the HTTP rewrite module requires the PCRE library.
    $ yum install -y pcre pcre-devel
    # 提示 error: Invalid C++ compiler or C++ compiler flags.
    $ yum install -y gcc gcc-c++
    # 提示 error: the HTTP gzip module requires the zlib library.
    $ yum install -y zlib-devel


4.依赖包安装完后,返回 nginx 解压目录,再次运行 ./configure 进行初始化即可
    

$ cd /home/nginx-1.21.2   # 返回 nginx 解压目录
$ ./configure   # 再次运行./configure


5在这一步需要下载这个headers-more-nginx-module插件用来去除server信息。下载地址:https://github.com/openresty/headers-more-nginx-module 
    注:这里可以使用git下载,如果centos系统中没有git的得先安装一个git,(自行搜索一下),不用git安装,也可以使用命令下载,以下,代码没有使用git安装。
   我们nginx-1.21.2在下新建个tools文件下,把headers-more-nginx-module放入
   

$ cd /home/nginx-1.21.2
$ mkdir tools
$ cd tools  #放到这里
$ wget https://github.com/openresty/headers-more-nginx-module/archive/v0.33.tar.gz
  #解压
$ tar -zxvf v0.33.tar.gz

6.追加./configure --prefix=/root/home/nginx-1.21.2 (这里是nginx解压的路径) \  --add-module=/root/home/nginx-1.21.2/tools/headers-more-nginx-module(这里是下载插件的路径路径,选择自己的路径就行)
然后make,切记没有make install

$ cd /nginx-1.21.2  
$ ./configure --prefix=/root/home/nginx-1.21.2   --add-module=/root/home/nginx- 1.21.2/tools/headers-more-nginx-module-0.33
$ make


7.然后在nginx.conf中添加

server:{
more_clear_headers 'Server';
more_clear_headers 'server';
}


8.重启一下nginx

 $ cd /root/home/nginx-1.21.2/sbin
 $ ./nginx -s stop   #停止
 $ ./nginx  #启动
 $ ps -ef | grep nginx #查看nginx状态,出现如下图内容说明启动成功


    

9完成


参考:
https://blog.csdn.net/Cs_Mervyn/article/details/120075477
https://blog.csdn.net/zzhongcy/article/details/115538272

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值