隐藏或修改nginx返回的Server信息(以及隐藏版本号)
2021/5/15 7:28:59
本文主要是介绍隐藏或修改nginx返回的Server信息(以及隐藏版本号),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
如何隐藏nginx版本号:
[root@localhost /]# vi /etc/nginx/nginx.conf [root@localhost /]# nginx -t [root@localhost /]# nginx -s reload
配置文件中,http区段中插入“server_tokens off;”,重新载入配置文件
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; server_tokens off; expires 5s; sendfile on;
隐藏或修改nginx返回的Server信息:
[root@localhost /]# vi /opt/nginx/nginx-1.2.0/src/http/ngx_http_special_response.c 找到29行:修改展示名称(LLSERVER) [root@localhost /]# "<hr><center>LLSERVER</center>" CRLF [root@localhost /]# cd /opt/nginx/nginx-1.2.0/src/http/ngx_http_header_filter_module.c [root@localhost /]# vi /opt/nginx/nginx-1.2.0/src/http/ngx_http_header_filter_module.c 找到49和50行: 修改展示名称(Server: LLSERVER) [root@localhost /]# static char ngx_http_server_string[] = "Server: LLSERVER" CRLF; [root@localhost /]# static char ngx_http_server_full_string[] = "Server: LLSERVER " NGINX_VER CRLF;
这篇关于隐藏或修改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负载均衡如何安装和配置?