How to hide nginx version?

With default Nginx configuration, Nginx response contains the Nginx Version number in the Headers , In the “Server” Header. Normally this is not an issue, but sometimes you might need to hide it. When you don’t want the visitors know the Server you are using or to prevent hackers to detect any security flows , you can hide the Nginx version.

You can check the nginx default headers using simple curl command

As you can see response Headers contains the “Server” Header which has the ServerVersion , which is “1.10.2” .

In this article we will explain how to Hide Nginx Version Number

You can hide Nginx Version Header by setting the “server_tokens” variable in the nginx configuration file.

Add the following line in the nginx configuration file, Under the “server” block.

Restart nginx once the changes are made

Now test it using curl

As you can see its not showing the Version now.


As always, feel free to drop us a note if you have any queries or feedbacks using our comment form below. Always happy to help you ????

Leave a Reply

Your email address will not be published. Required fields are marked *