【修改配置文件】(不卸载Nginx隐藏版本号,直接修改配置文件)
Linux环境:
[root@localhost nginx-1.16.1]# curl -I http://10.56.1.115
HTTP/1.1 200 OK
Server: nginx/1.16.0 //原版本号
Date: Thu, 12 Sep 2019 05:38:07 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Thu, 12 Sep 2020 08:37:35 GMT
Connection: keep-alive
ETag: "5d349f-262"
Accept-Ranges: bytes
[root@localhost nginx-1.16.1]# vim /usr/local/nginx/conf/nginx.conf
在sendfile on;后添加一行命令:
server_tokens off;