当前位置:论坛首页 > Linux面板 > 求助

【已完成】nginx中浏览器中查看的server信息如何隐藏

发表在 Linux面板2024-3-7 10:40 [复制链接] 2 1424

为了能快速了解并处理您的问题,请提供以下基础信息:
面板、插件版本:8.05

系统版本:CentOS 8

问题描述:nginx中浏览器中查看的server信息如何隐藏

使用道具 举报 只看该作者 回复
发表于 2024-3-7 11:49:49 | 显示全部楼层
您好,Nginx当前已经隐藏了Nginx的版本了,如果需要连Server也要重新自定义,需要修改
/www/server/nginx/src/src/http/ngx_http_header_filter_module.c
中的第49--50行为
  1. static u_char ngx_http_server_string[] = "Server: dapaoweb" CRLF;
  2. static u_char ngx_http_server_full_string[] = "Server: dapaoweb" CRLF;
  3. static u_char ngx_http_server_build_string[] = "Server: dapaoweb" CRLF;
复制代码


编译步骤:
1、进入到Nginx源码目录,并停止当前Nginx:
  1. cd /www/server/nginx/src &&  /etc/init.d/nginx stop
复制代码

2、取消之前的makefile
  1. make clean
复制代码

3、进行配置和设置编译选项
  1. ./configure --user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl=/www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --add-module=/www/server/nginx/src/ngx_http_substitutions_filter_module-master --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-ld-opt=-ljemalloc --with-http_dav_module --add-module=/www/server/nginx/src/nginx-dav-ext-module
复制代码

4、编译并安装
  1. make  && make install
复制代码

5、启动Nginx
  1. /etc/init.d/nginx start
复制代码

验证:
nginx重新编译.png
使用道具 举报 回复 支持 反对
发表于 2025-1-23 01:30:43 | 显示全部楼层
我看我已经安装了luajit,但是编译安装nginx的时候提示没有。怎么处理呢?
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

立即付费处理

工作时间:09:00至24:00

快速回复 返回顶部 返回列表