Hide Nginx Server Version in Linux

In this article, I’m going to show how to hide Nginx server signature in Linux. Generally, on 404 page, the server shows it’s version with operating system name. To secure our server, we should hide this info. Let’s take a look at the solution.

Problem

Server is displaying it’s server and OS name:

Solution

The “server_tokens” directive shows the version and OS name. We need to turn it off. The server_tokens directive exists in /etc/nginx/nginx.conf configuration file.

Open the nginx config file:

sudo nano /etc/nginx/nginx.conf

Turn server_tokens off:

server_tokens off;

Then we need to save the config & restart nginx server:

sudo systemctl restart nginx

Test

Now visit 404 page and take a look:

That’s all. Thanks for reading.