Home >Operation and Maintenance >Nginx >How to disable server_tokens item in Nginx configuration

How to disable server_tokens item in Nginx configuration

WBOY
WBOYforward
2023-05-12 08:37:213200browse

Disable the server_tokens item in Nginx configuration

When server_tokens is turned on, the 404 page will display the current version number of Nginx. This is clearly unsafe as hackers could use this information to try vulnerabilities in the corresponding Nginx version.

You only need to set server_tokens off in the http module in nginx.conf, for example:

server { listen 192.168.0.25:80; Server_tokens off; server_name tecmintlovesnginx.com www.tecmintlovesnginx.com; access_log /var/www/logs/tecmintlovesnginx.access.log; error_log /var/www/logs/tecmintlovesnginx.error.log error; root /var/www/tecmintlovesnginx.com/public_html; index index.html index.htm; }

It will take effect after restarting Nginx

The above is the detailed content of How to disable server_tokens item in Nginx configuration. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete