我需要取消注释nginx.conf中的以下行
#server_tokens off;
Run Code Online (Sandbox Code Playgroud)
但我不想直接在nginx.conf中这样做,所以是否可以在另一个地方进行此更改,例如放在/etc/nginx/conf.d/目录中的一些配置文件?
这可以在http,服务器或位置块中更改.
syntax: server_tokens on | off;
default: server_tokens on;
context: http, server, location
Run Code Online (Sandbox Code Playgroud)
启用或禁用在错误消息和"服务器"响应头字段中发出nginx版本.
资料来源:http://nginx.org/en/docs/http/ngx_http_core_module.html#server_tokens