Erik
Erik

Reputation: 14778

Is it possible to change server_tokens directive not in nginx.conf?

I need to uncomment the following line in nginx.conf

#server_tokens off;

But I don't want do it in nginx.conf directly so is it possible to make this change in another place like in some config files placed at /etc/nginx/conf.d/ directory?

Upvotes: 2

Views: 3807

Answers (1)

Tan Hong Tat
Tan Hong Tat

Reputation: 6864

This can be changed in either http, server or location block.

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

Enables or disables emitting nginx version in error messages and in the “Server” response header field.

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

Upvotes: 7

Related Questions