Nginx 隐藏版本信息和logo

1.隐藏版本信息

复制代码
http {
   ### 隐藏版本号    
   server_tokens off;
}

2.隐藏图标

2.1 cd nginx 安装的路径

cd/XXXX/nginx-1.2.0

2.2 编辑文件

vim src/core/nginx.h 修改define nginx_ver 中的内容

vim src/http/ngx_http_special_response.c 修改 u_char ngx_http_error_tail[] 下面的内容

vim src/http/ngx_http_header_filter_module.c 修改u_char ngx_http_server_string[]中内容

4.查看之前版本安装的信息

/opt/nginx/sbin/nginx -V

5.重新编译和make

复制代码
./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-stream --with-http_gzip_static_module --with-openssl=/usr/local/openssl --add-module=/usr/local/fastdfs-nginx-module/src

6.备份和升级

备份之前的nginx

复制代码
mv /opt/nginx/sbin/nginx /opt/nginx/sbin/nginx.old
### 复制新的nginx
cp /opt/nginx-1.2/objs/nginx /opt/nginx/sbin/nginx
### 在/opt/nginx-1.2目录下
make upgrade
相关推荐
甲鱼9293 小时前
MySQL 实战手记:日志管理与主从复制搭建全指南
运维
闲云一鹤2 天前
nginx 快速入门教程 - 写给前端的你
前端·nginx·前端工程化
碳基沙盒2 天前
OpenClaw 多 Agent 配置实战指南
运维
蝎子莱莱爱打怪5 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
何中应5 天前
Nginx转发请求错误
前端·后端·nginx
DianSan_ERP6 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅6 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒6 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
芝士雪豹只抽瑞克五6 天前
Nginx 高性能Web服务器笔记
服务器·nginx