Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx "server_tokens" configuration ignored

Tags:

nginx

nginx.conf:

server_tokens off; 

Why could this get ignored, the header is still sent:

Server: nginx 

No, other included config files do not contain server_tokens configuration.

Yes, I did restart all services.

like image 492
Daniel W. Avatar asked Nov 27 '13 15:11

Daniel W.


People also ask

What is Server_tokens in Nginx?

The “server_tokens” directive is responsible for displaying the Nginx version number and Operating system on error pages and in the “Server” HTTP response header field as shown in the following screenshot. Nginx Version Number. To disable this, you need to turn off the server_tokens directive in /etc/nginx/nginx.

What is server_ tokens?

The ServerAdmin and ServerTokens directives control what information about the server will be presented in server-generated documents such as error messages. The ServerTokens directive sets the value of the Server HTTP response header field.

What is Nginx Sendfile?

Enabling sendfile By default, NGINX handles file transmission itself and copies the file into the buffer before sending it. Enabling the sendfile directive eliminates the step of copying the data into the buffer and enables direct copying data from one file descriptor to another.


1 Answers

To cite the docs on the server_tokens directive:

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

According to the docs, it thus doesn't prevent the generation of the Server header but only prevents the addition of the exact version. If you want to completely remove the servers header, you could use the ngx_headers_more module.

like image 109
Holger Just Avatar answered Sep 25 '22 17:09

Holger Just