如何隐藏HTTP头中的Nginx版本

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

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

检查不安全的HTTP头

检查你的服务器的http头,你会看到版本的NGINX服务器运行。
黑客可以利用这些信息进行黑客活动。

$ curl -I http://example.com
You can see that your server is running with NGINX 1.10.0 server.
HTTP/1.1 200 OK
Server: nginx/1.10.0 (Ubuntu)
Date: Wed, 26 Oct 2016 11:48:36 GMT
Content-Type: text/html
Content-Length: 11321
Last-Modified: Thu, 20 Oct 2016 05:30:08 GMT
Connection: keep-alive
ETag: "58649f60-2c39"
Accept-Ranges: bytes

隐藏Apache2版本

编辑NGIX配置文件,并将' server_tokens '变量值设置为' off ',在http、服务器或位置部分如下。

server_tokens off;

检查不安全的HTTP头

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

$ curl -I http://example.com
Now you can see that header is only showing that Apache is runnign, but no version or OS details available there.
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 26 Oct 2016 11:48:36 GMT
Content-Type: text/html
Content-Length: 11321
Last-Modified: Thu, 20 Oct 2016 05:30:08 GMT
Connection: keep-alive
ETag: "58649f60-2c39"
Accept-Ranges: bytes