Open In App

How to Hide Nginx Server Version in Linux?

Last Updated : 17 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Here we will see how to hide the Nginx server version from error pages and the “Server HTTP” response header field in Linux. This is one of the most important security recommendations for your Nginx HTTP and proxy server.

The Nginx will show the version on error pages and in the “Server” response header field.

Hide Nginx Server Version in Linux

Hiding The Nginx version:

To hide the Nginx server version on Linux and Unix-like systems, set server tokens to off. Using a text editor like vim/nano, edit the nginx.conf file:

$ sudo nano /etc/nginx/nginx.conf
Hide Nginx Server Version in Linux

Find server_token off;

Now Uncomment server_tokken off:

Hide Nginx Server Version in Linux

Uncomment server_token off;

Now save the file and restart Nginx server to take effect.

$ sudo systemctl restart nginx
Hide Nginx Server Version in Linux

Restart Nginx server

Verify that Nginx version is hidden:

Now verify Nginx version hidden or not.

Hide Nginx Server Version in Linux

Verify Nginx hidden or not

On Linux or Unix-based systems, we’ve shown you how to easily hide the Nginx version. Nginx plus (commercial/paid option) users can also create their own Nginx version.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads