如何隐藏HTTP头中的Apache版本

时间:2019-05-19 01:26:11  来源:igfitidea点击:

在配置生产和开发基础设施时。
首要的问题应该是安全。
你将来可能会面临严重的后果。
我们必须在许多方面应用于安全性。
在这种情况下,如果我们使用Apache服务器运行应用程序,我们应该在服务器上应用此安全提示。

检查不安全的HTTP头

检查服务器的HTTP头,我们将看到Apache2服务器的版本正在运行。
黑客可以利用这些信息进行黑客活动。

$ curl -I  http://example.com

我们可以看到服务器使用Apache 2.4.18服务器运行。

HTTP/1.1 200 OK
Date: Wed, 25 Oct 2016 11:36:14 GMT
Server: Apache/2.4.18 (Ubuntu)
Last-Modified: Thu, 20 Oct 2016 05:30:08 GMT
ETag: "2c39-544c560e55e60"
Accept-Ranges: bytes
Content-Length: 11321
Vary: Accept-Encoding
Content-Type: text/html

隐藏Apache版本

编辑Apache配置文件,并添加/编辑以下变量。
做出更改后,重新启动Apache服务。

ServerTokens Prod
 ServerSignature Off

检查HTTP头

完成上述更改后,使用以下命令重新检查HTTP头值。

$ curl -I  http://example.com

现在我们可以看到,头信息只显示Apache正在运行,但没有版本或操作系统的详细信息。

HTTP/1.1 200 OK
Date: Wed, 25 Oct 2016 11:36:14 GMT
Server: Apache
Last-Modified: Thu, 20 Oct 2016 05:30:08 GMT
ETag: "2c39-544c560e55e60"
Accept-Ranges: bytes
Content-Length: 11321
Vary: Accept-Encoding
Content-Type: text/html