How-To Guides and Blog

How to Hide Nginx Version

NBH Support
No Comments

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.

, How to Hide Nginx Version, New Blog Hosting

Step 1 – Open the file nginx.conf

sudo nano /etc/nginx/nginx.conf

Step 2 – Set server_tokens to off

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.

, How to Hide Nginx Version, New Blog Hosting

Step 3 – Restart Nginx

/etc/init.d/nginx restart


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

That’s it!

In this tutorial we explained step by step how to hide nginx version.

Leave a Comment