码迷,mamicode.com
首页 > 其他好文 > 详细

nginx 隐藏版本信息

时间:2017-11-20 20:27:57      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:logs   情况   pre   clu   header   技术   type   http   stream   

1. 编辑 nginx.conf 文件

http {

    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off; #隐藏软件版本信息
...

 

server_token 作用是控制 http response header 内的 web 服务版本信息的显示,以及错误信息中 Web 服务版本信息的显示。

默认情况下,该参数为 server_token on;

2. 测试,重载 nginx

[root@localhost sbin]# ./nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
[root@localhost sbin]# ./nginx -s reload

3. 查看结果

技术分享图片

 

nginx 隐藏版本信息

标签:logs   情况   pre   clu   header   技术   type   http   stream   

原文地址:http://www.cnblogs.com/reycg-blog/p/7867840.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!