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

【已解答】网站响应相关设置防护 Server: Apache

发表在 Linux面板昨天 22:33 [复制链接] 1 19

Rocky 9.5  宝塔 9.6.0  Apache 2.4.62  PHP 8.2.27
架设的网站 不管是原生PHP 站 或者带框架网站



响应里面  都带 Server: Apache  怎么设置都没用 去除不掉  

网站配置文件里面设置了  相关     

# 正确配置 Header 指令
    <IfModule mod_headers.c>
        Header always set Server "WebServer"
        Header always unset Server
    </IfModule>
以及 Apache  配置文件里面设置了   

# 彻底禁止Apache发送Server头
ServerTokens Prod
ServerSignature Off
TraceEnable Off

或者

<IfModule mod_headers.c>    Header always set Server "WebServer"    Header always unset Server    RequestHeader unset Server</IfModule>
各种办法都测试了 就是去除不掉


HTTP/1.1 200 OK
Date: Fri, 23 May 2025 14:21:23 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: my_app_session=4lg9abmabd8a5kvnh5j249h8a6; expires=Fri, 23-May-2025 14:51:23 GMT; path=/; HttpOnly
Upgrade: h2,h2c
Connection: Upgrade, Keep-Alive
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 7794
Keep-Alive: timeout=5, max=1000
Content-Type: text/html
使用道具 举报 只看该作者 回复
发表于 7 小时前 | 显示全部楼层
这种需要重新编译apache
可以参考以下方法,卸载apache,编辑脚本文件/www/server/panel/install/apache.sh
在编译前面添加下面内容:
  1. cd include
  2.     sed -i 's/^#define AP_SERVER_BASEVENDOR .*/#define AP_SERVER_BASEVENDOR   "CustomVendor"/' ap_release.h
  3.     sed -i 's/^#define AP_SERVER_BASEPROJECT .*/#define AP_SERVER_BASEPROJECT  "WebServer"/' ap_release.h
  4.     sed -i 's/^#define AP_SERVER_BASEPRODUCT .*/#define AP_SERVER_BASEPRODUCT  "WebServer"/' ap_release.h
  5.     cd ..
复制代码
终端执行安装命令:
  1. bash /www/server/panel/install/apache.sh install 24
复制代码

aa.png

使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

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

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

紧急运维服务

响应时间:3分钟

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

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

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

点击联系技术免费分析

工作时间:09:00至18:30

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