nginx隐藏版本号
nginx隐藏版本号
1、未修改配置文件前
[[email protected] ~]# curl -I localhost:80
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Tue, 03 Mar 2020 03:48:10 GMT
Content-Type: text/html
Content-Length: 4833
Last-Modified: Fri, 16 May 2014 15:12:48 GMT
Connection: keep-alive
ETag: "53762af0-12e1"
Accept-Ranges: bytes
2、修改配置文件
#vim /etc/nginx/nginx.conf
在http模块下面加上:
server_tokens off;
#vim /etc/nginx/fastcgi.conf注释下面这项配置
#fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
然后reload nginx
3、修改配置文件后
[[email protected] ~]# curl -I localhost:80
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 03 Mar 2020 03:49:14 GMT
Content-Type: text/html
Content-Length: 4833
Last-Modified: Fri, 16 May 2014 15:12:48 GMT
Connection: keep-alive
ETag: "53762af0-12e1"
Accept-Ranges: bytes