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:
Open the Nginx configuration file, typically located at "/etc/nginx/nginx.conf".
In the "http" block of the configuration file, add the following line:
server_tokens off;
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.