如何隐藏Nginx的版本号?

Nginx

1 前言

一个问题,一篇文章,一出故事。
最近外部的安全扫描发现我们一个站点对外宣告Nginx的版本号,于是我们需要修改参数隐藏Nginx的版本号。

Server information header exposed
www.cmdschool.org:80
Exposing information about the server version increases the ability of attackers to exploit certain vulnerabilities. The website configuration should be
changed to prevent version information being revealed in the 'server' header.
Expected Headers > server: [does not contain version number]
Actual nginx/1.26.0
First
detected
Jun 3, 2024

2 最佳实践

2.1 安装运行环境

vim /etc/nginx/nginx.conf

修改如下参数,

http {
    #...
    server_tokens off;
    #...
}

2.2 重载服务使配置生效

systemctl reload nginx
没有评论

发表回复

Nginx
如何解决https请求不安全http页被阻止问题?

1 前言 一个问题,一篇文章,一出故事。 笔者最近代理公司应用,发现https的页面有请求不安全的h …

Nginx
如何Nginx代理上游的子项目或文件夹?

1 前言 一个问题,一篇文章,一出故事。 笔者接到任务需要把Tomcat的其中一个应用号使用Ngin …

Nginx
如何安装部署RHEL 9 Nignx?

1 前言 一个问题,一篇文章,一出故事。 笔者需要基于RHEL 9部署Nginx环境,于是整理此文。 …