How to view and hide NGINX server header information

October 4, 2023 / How-to Guide

This article explains how to view and hide NGINX server header information.

Follow the steps-

  1. To check your current server information, you can execute the following command-
    curl –head yourdomain.com
  2. Users can also view server information using online tools such as-https://securityheaders.com
    https://observatory.mozilla.org.
    Nevertheless, you will still have to utilise the terminal to implement essential modifications to your server.
  3. In the default setup, the initial two lines of outcomes will exhibit information such as the HTTP protocol, the HTTP status code (200, 301, 302, etc.) corresponding to the returned information, and details about the server version. For instance-
    HTTP/2 200
    server: nginx/1.16.7
  4. We will eliminate the version number so that it becomes difficult for the cyber attackers to infect your server-
    1. Edit the NGINX configuration file-
      nano /etc/nginx/nginx.conf
    2. Under the # HTTP Options and ## lines, enter a new line-
      server_tokens off;
    3. Save the changes- Ctrl + x.
    4. Examine your NGINX server information, using the following command-
      curl –head yourdomain.com
    5. These modifications may take up to a few hours to reproduce in header information, based on system caching settings.

In such a manner, you can view and hide NGINX server header information. For extra help, get in touch with our support staff. They are available 24×7.

Spread the love
Dominos Search