隐匿版本号
隐藏Nginx版本号,避免安全漏洞泄漏
第一种是修改 Nginx的主配置文件
第二种是修改Nginx源码文件,指定不显示版本号
[root@localhost ~]# curl -I localhost ##可以查看版本号等详细信息
HTTP/1.1 200 OK
Server: nginx/1.15.9
……省略部分
修改配置,隐匿版本
[root@localhost ~]# vi /usr/local/nginx/conf/nginx.conf
http {
include mime.types;
default_type application/octet-stream;
server_tokens off; ###插入这段字,隐匿服务器版本(on为开启,off为关闭)
……省略部分
[root@localhost~]# systemctl restart nginx ###重启Nginx服务
[root@localhost ~]# curl -I 127.0.0.1 ##再次查看,版本已经被隐匿
HTTP/1.1 200 OK
Server: nginx
……省略部分
配置网页缓存时间