How To Hide Nginx Server Header

Hide Nginx Server Header

In this tutorial, we will show you how to hide Nginx Server Header on your Linux server. In default Nginx configuration, the server sends HTTP Header with the information of the Nginx version number of the Server. The HTTP response header “Server” displays the version number of the server. This information can be used to try to exploit any vulnerabilities in the Nginx, especially if you are running an older version with known vulnerabilities. Hiding the Nginx version is very easy and it’s done using the server_tokens directive. This tutorial helps you customize the name of the server on your host.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges.


  • A server running one of the following operating systems: RHEL-based such as CentOS, AlmaLinux, or Rocky Linux.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Hide Nginx Server Header

Step 1. Installing Nginx on your system.

This tutorial requires Nginx to be installed on your server. So first of all, Make sure you have an Nginx web server installed on your system.

Step 2. Go to nginx.conf folder (it can be located at /etc/nginx/nginx.conf or /usr/local/nginx/conf/nginx.conf file)

Step 3. Hide the Nginx version.

Add the following in nginx.conf under server section:

server_tokens off;

After that, restart the Nginx web server using the following command below:

service nginx restart

Let’s verify if we see the server information now:

curl -I
HTTP/1.1 200 OK
Server: nginx
Date: Sun, 03 Aug 2021 06:06:52 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

Congratulations! You have successfully hidden the Nginx version. Thanks for using this tutorial for hiding the Nginx version in the Linux system. For additional help or useful information, we recommend you check the official Nginx website.

Nginx Install Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “Nginx Webserver” installation, starting from $10 (Paypal payment). Please contact us to get the best deal!