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:
- Open the Nginx configuration file, usually in
/etc/nginx/nginx.conf
or/usr/local/nginx/conf/nginx.conf
.http
Add 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.
- Save the configuration file and restart Nginx.
sudo nginx -t
sudo systemctl reload nginx
This way you can hide the Nginx version number.