如何在不使用mod_security的情况下更改Apache的"Server:"标头? [英] How to change Apache's 'Server:' header without mod_security?

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

问题描述

如何在不使用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的"Server:"标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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