Hide Nginx Server Version in Linux

Published on April 2, 2021 27 sec read

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. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.
Author

Hey, I'm Md Obydullah. I build open-source projects and write article on Laravel, Linux server, modern JavaScript and more on web development.

Follow

2 Replies to “Hide Nginx Server Version in Linux”

Leave a Reply