How to hide version number in Nginx

Nginx is a high-performance web server software that supports reverse proxy, load balancing, caching and other functions. In the process of using Nginx, sometimes we need to hide the Nginx version number to enhance the security of the server.

Hidden version number

To hide the Nginx version number, we need to modify the Nginx configuration file. Specific steps are as follows:

  1. Open the Nginx configuration file, usually in /etc/nginx/nginx.confor /usr/local/nginx/conf/nginx.conf.
  2. httpAdd the following in the block :
server_tokens off;

The function of this command is to turn off the display of Nginx version number and operating system information.

  1. Save the configuration file and restart Nginx.
sudo nginx -t
sudo systemctl reload nginx

This way you can hide the Nginx version number.

Guess you like

Origin blog.csdn.net/qq_43597256/article/details/131182660