Hiding nginx version from showing on error pages/headers it’s easy, to do that we need to set
server_tokens off; on the nginx.conf file which is located to /etc/nginx/nginx.conf.
sudo nano /etc/nginx/nginx.conf
We need to make sure that server_tokens is set to off and that it’s not commented. After setting server_tokens to off, press ctrl+x to save changes and exit.
It should look like this.
service nginx restart
Once we restart the nginx server, we need to check server headers to verify that nginx version it’s not showing on headers. You can use either curl to view http headers or any other http header checker you want.
Check server’s headers via curl
curl -I http://yoursite.com
In this tutorial we explained step by step how to hide nginx version.