The “server_tokens” directive is responsible for displaying the Nginx version number and Operating system on error pages and in the “Server” HTTP response header field as shown in the following screenshot.
To disable this, you need to turn off the server_tokens directive in /etc/nginx/nginx.conf configuration file.
vi /etc/nginx/nginx.conf