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
相关推荐
一只栖枝1 小时前
华为 HCIE 大数据认证中 Linux 命令行的运用及价值
大数据·linux·运维·华为·华为认证·hcie·it
wuicer4 小时前
ubuntu 20.04 安装anaconda以及安装spyder
linux·运维·ubuntu
小晶晶京京6 小时前
day34-LNMP详解
linux·运维·服务器
fengyehongWorld6 小时前
Linux crontab定时任务
linux·运维
碎像7 小时前
Linux上配置环境变量
linux·运维·服务器
sunflower_w9 小时前
linux I2C核心、总线与设备驱动
linux·运维·服务器
myzzb9 小时前
基于uiautomation的自动化流程RPA开源开发演示
运维·python·学习·算法·自动化·rpa
伊成10 小时前
Docker 部署 Nginx 完整指南
nginx·docker·容器
网硕互联的小客服10 小时前
Apache 如何支持SHTML(SSI)的配置方法
运维·服务器·网络·windows·php
落日漫游11 小时前
K8s核心组件全解析
运维·docker·运维开发