1

I have a ubuntu server which has nginx 1.12.0 installed and i want to completely remove the server Response header

Server:nginx

If i install nginx-extras it will install the nginx/1.1.19 version and it will also disable the Etags,Are there any other options to remove the server header

2

2 Answers 2

1

Add this server_tokens off; on your nginx.conf under server section.

This will remove the Server: nginx 1.12.0 server header

Update:

You need to compile it from source. Here's the link I got from DO.

Download the nginx package then follow this steps:

cd ~/src/nginx/
vi +49 src/http/ngx_http_header_filter_module.c

Find the lines:

static char ngx_http_server_string[] = "Server: nginx" CRLF;
static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;

Modify to:

static char ngx_http_server_string[] = "Server: custom-server-name" CRLF;
static char ngx_http_server_full_string[] = "Server: custom-server-name" CRLF;

This

2
  • That will remove the server version but it will still print Server: nginx but my requirement is to completely remove server header
    – Sam Hams
    Mar 12, 2018 at 15:33
  • I will just edit my answer above on how you can fix it. Mar 12, 2018 at 15:59
1

You have to have commercial subscription to nginx in order to remove nginx from your response body using server tokens 'string'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .