Nginx隐藏响应头信息的Server信息和版本信息
2022/8/8 5:22:45
本文主要是介绍Nginx隐藏响应头信息的Server信息和版本信息,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
问题如下
解决办法
- 隐藏nginx版本信息
nginx/conf/nginx.conf
http { ... server_tokens off ... }
- 隐藏server信息
实现方案:需要重新编译nginx
进入解压出来的nginx
源码目录(不是nginx的安装目录)
vim src/http/ngx_http_header_filter_module.c # 49-50行
内容
static char ngx_http_server_string[] = "Server: nginx" CRLF;static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
更改为
static char ngx_http_server_string[] = "Server: Web" CRLF;static char ngx_http_server_full_string[] = "Server:Web " CRLF;
修改完后重新编译nginx,再看header里面Server信息变成了自定义的信息,不再显示nginx
信息了。
这篇关于Nginx隐藏响应头信息的Server信息和版本信息的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-29fail2ban nginx
- 2024-03-18install nginx proxy manager
- 2024-01-2444从零开始用Rust编写nginx,命令行参数的设计与解析及说明
- 2024-01-22比Nginx更好用的Gateway!
- 2024-01-17nginx daemon off
- 2023-12-30Nginx Vhost Traffic Status 是什么意思-icode9专业技术文章分享
- 2023-12-26使用nginx搭建creates.io镜像(稀疏索引)
- 2023-11-18centos7编译安装Nginx教程。
- 2023-11-02nginx启动命令和停止命令
- 2023-10-25Centos7系统Nginx负载均衡如何安装和配置?