修改nginx的http响应头server,以及真实ip模块、ssl模块、压缩模块的安装
修改nginx的http响应头server字段
修改源码 src/http/ngx_http_header_filter_module.c
修改前:
static u_char ngx_http_server_string[] = "Server: nginx" CRLF;
static u_char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER CRLF CRLF;
修改后:
static u_char ngx_http_server_string[] = "Server: X-Web" CRLF;
static u_char ngx_http_server_full_string[] = "Server: X-Web" CRLF;
static u_char ngx_http_server_build_string[] = "Server: X-Web" CRLF;
nginx安装https模块时,with-openssl 为openssl得源码路径,不是安装之后的路径
./configure --prefix=/opt/local/nginx --sbin-path=/opt/local/nginx/sbin/nginx --pid-path=/opt/logs/nginx/nginx.pid --error-log-path=/opt/logs/nginx/logs/error.log --http-log-path=/opt/logs/nginx/logs/access.log --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-http_realip_module --with-openssl=/opt/soft/openssl-3.0.3
其中http_realip_module 为真实ip模块,http_gzip_static_module 为压缩模块
真实ip模块配置如下:
real_ip_header X-Forwarded-For;
set_real_ip_from x.x.x.x;
其中x.x.x.x 为来源ip,比如waf的ip
查看日志:
tail -200f 8002_access.log |cut -d " " -f 1,4,7,9
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
2013-06-21 jquery图片轮播切换
2013-06-21 jquery实现图片延迟加载
2013-06-21 java反射机制修改final变量的值