In default Nginx configuration, the server sends HTTP Header with the information of Nginx version number of the Server. The HTTP response header “Server” displays the version number of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Nginx, specially if you are running an older version with known vulnerabilities.
Sample HTTP Response Header:
HTTP/1.1 200 OK Server: nginx/1.2.6 (Ubuntu) Date: Wed, 31 Jul 2013 19:47:33 GMT
There is an easy way to hide the Nginx version number from the HTTP headers. By setting the “server_tokens” variables in your nginx.conf file the server information would not longer be added to the HTTP headers. Use the following lines in you nginx.conf file. Make sure to back up you file before editing so that in case something goes wrong you can easily revert. After making the changes restart your nginx (Note: Doing so will take your site down, if it runs only on 1 server).
server_tokens off;
HTTP/1.1 200 OK Server: nginx Date: Wed, 31 Jul 2013 19:49:15 GMT
Thanks. it works good.
Use this on a newer version of Nginx:
more_clear_headers ‘Server’;
more_set_headers ‘Server: LOOK-CLOSER’;