是否可以在nginx.conf中更改server_tokens指令?

时间:2014-05-22 04:23:37

标签: nginx

我需要取消注释nginx.conf中的以下行

#server_tokens off;

但是我不想直接在nginx.conf中这样做,所以是否可以在/etc/nginx/conf.d/目录下的某些配置文件中进行此更改?

1 个答案:

答案 0 :(得分:5)

可以在http,服务器或位置块中更改。

syntax:     server_tokens on | off;
default:    server_tokens on;
context:    http, server, location
  

启用或禁用在错误消息和“服务器”响应标头字段中发出nginx版本。

来源:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens