tags:

views:

2315

answers:

5

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change it?

A: 

Are you asking about the Server header value in the response? You can try changing that with an add_header directive, but I'm not sure if it'll work. http://wiki.codemongers.com/NginxHttpHeadersModule

Vasil
yes, the server header. but isn't there a cleaner way like on lighttpd for example where i just have server.tag="whatever"? the add_header works only for response codes 200, 204, 301, 302 or 304, so if server will somehow do a 500 it will not work
daniels
+4  A: 

Like Apache, this is a quick edit to the source and recompile. From Calomel.org:

The Server: string is the header which is sent back to the client to tell them what type of http server you are running and possibly what version. This string is used by places like Alexia and Netcraft to collect statistics about how many and of what type of web server are live on the Internet. To support the author and statistics for Nginx we recommend keeping this string as is. But, for security you may not want people to know what you are running and you can change this in the source code. Edit the source file src/http/ngx_http_header_filter_module.c at look at lines 48 and 49. You can change the String to anything you want.

## vi src/http/ngx_http_header_filter_module.c (lines 48 and 49)
static char ngx_http_server_string[] = "Server: MyDomain.com" CRLF;
static char ngx_http_server_full_string[] = "Server: MyDomain.com" CRLF;
joelhardi
+2  A: 

The only way is to modify the file src/http/ngx_http_header_filter_module.c . I changed nginx on line 48 to a different string.

What you can do in the nginx config file is to set *server_tokens* to off. This will prevent nginx from printing the version number.

To check things out, try curl -I http://vurbu.com/ | grep Server

It should return

Server: Hai
Jauder Ho
+1  A: 

Look at the server_tokens off; directive here:

http://wiki.nginx.org/NginxHttpCoreModule#server_tokens

Morris
+3  A: 

There is a special module: http://wiki.nginx.org/NginxHttpHeadersMoreModule

Flavius