How to hide Nginx version on Linux and Unix

h‮t‬tps://www.lautturi.com
How to hide Nginx version on Linux and Unix

To hide the version of an Nginx web server on Linux or Unix, you can use the "server_tokens" directive in the Nginx configuration file. This directive controls whether the Nginx version number is included in the "Server" header field in HTTP responses.

To hide the Nginx version, follow these steps:

  1. Open the Nginx configuration file, typically located at "/etc/nginx/nginx.conf".

  2. In the "http" block of the configuration file, add the following line:

server_tokens off;
  1. Save the configuration file and reload the Nginx server by running the following command:
nginx -s reload

With this configuration, Nginx will not include the version number in the "Server" header field of HTTP responses. Instead, it will only include the string "nginx".

Note: Hiding the version of an Nginx server can help to protect against certain types of attacks, but it is not a substitute for proper security measures such as keeping the server and its software up to date and configuring firewall rules to restrict access to the server.

Created Time:2017-10-28 21:39:03  Author:lautturi