如何在没有 mod_security 的情况下更改 Apache 的“服务器:"标头? [英] How to change Apache's 'Server:' header without mod_security?

查看:36
本文介绍了如何在没有 mod_security 的情况下更改 Apache 的“服务器:"标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在没有 mod_security 的情况下更改 Apache 的 Server: 标头?

How to change Apache's Server: header without mod_security?

我不想使用 mod_security,因为我没有其他任何事情要做.这对我来说是无用的开销.

I do not want to use mod_security because I don't have anything else to do with it. And it is a useless overhead for me.

相反,我应该在 Apache 的源代码中更改什么?我通常使用从源代码编译的 Apache.

Instead, what should I change in the Apache's source? I usually use Apache compiled from source.

我使用的是 Apache 2.4.46 版.

I am using Apache version 2.4.46.

推荐答案

要更改 Apache 的 Server: 标头,请在源代码中更改以下内容:

To change Apache's Server: header, change the following in the source code:

更改文件/path/to/httpd-2.4.46/include/ap_release.h:

转到如下行:

...
#define AP_SERVER_BASEPROJECT "Apache HTTP Server"
#define AP_SERVER_BASEPRODUCT "Apache"
...

并将其更改为任何内容,例如:

And change it to anything, like:

...
#define AP_SERVER_BASEPROJECT "Apache Something My Server"
#define AP_SERVER_BASEPRODUCT "Apache My Server"
...

然后编译apache,你就好了!

And then compile apache, and you are good!

另外,请确保遵循随它提供的许可证.此处有关许可证的问题是题外话.

Also, make sure to follow the license that is provided with it. Questions about license here are off-topic.

这篇关于如何在没有 mod_security 的情况下更改 Apache 的“服务器:"标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆