nginx 隐藏版本信息

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. 查看结果

 

posted @ 2017-11-20 19:18  ReyCG  阅读(1122)  评论(0)    收藏  举报