关闭Nginx版本号

1、修改配置文件nginx.conf

]# vi /etc/nginx/nginx.conf
...
server {
...
  server_tokens off;
...
}
...

2、重新加载nginx

systemctl restart nginx

3、访问测试

~]# curl 192.168.10.27 -I
HTTP/1.1 200 OK
Server: nginx  # 此处已经没有版本号了
Date: Wed, 10 May 2023 13:15:05 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

 

posted @ 2023-05-10 21:16  小粉优化大师  阅读(323)  评论(0编辑  收藏  举报