环境说明:①操作系统:windows server;②nginx:1.27.1。
1.漏洞说明
“可通过HTTP获取远端WWW服务信息”。
修复前,在“响应标头”能看到Server信息,如下图所示:
修复后,“响应标头”已移除Server信息,如下图所示:
2. 网上解决方案
①方法1:Nginx添加扩展headers-more-nginx-module。这种方法需要下载扩展模块,重新编译、安装,比较麻烦。
②方法2:直接使用Openresty替换Nginx。OpenResty已经集成了headers-more-nginx-module模块。且使用上跟直接使用nginx一样。
3.替换nginx
3.1 替换配置文件
替换过程比较简单,把原来的nginx.conf文件拷贝到OpenResty对应位置。重新启动OpenResty即可。
3.2 修改配置
-
openresty的nginx.conf配置中,关于文件夹路径改用绝对路径,否则报500错误。
-
openresty的nginx.conf配置文件中的http节点下添加more_clear_headers ‘Server’;
more_clear_headers 'Server'
4.OpenResty介绍
OpenResty® is a full-fledged web platform that integrates our enhanced version of the Nginx core, our enhanced version of LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules, and most of their external dependencies. It is designed to help developers easily build scalable web applications, web services, and dynamic web gateways.
详见官网:https://openresty.org/en/