Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to hide the Nginx version number

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to hide the Nginx version number". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Nginx displays the version number by default, such as:

[root@hadooptest] # curl-I www.nginx.orghttp/1.1 200 okserver: nginx/0.8.44date: tue, 13 jul 2010 14:05:11 gmtcontent-type: text/htmlcontent-length: 8284last-modified: tue, 13 jul 2010 12:00:13 gmtconnection: keep-alivekeep-alive: timeout=15accept-ranges: bytes

In this way, people will see that your server nginx version is 0.8.44. some time ago, there were some nginx version vulnerabilities, that is, some versions have vulnerabilities and some versions do not. In this way, the exposed version number can easily become information that can be used by an attacker. Therefore, from a security point of view, the hidden version number will be relatively safe!

Can the nginx version number be hidden? Actually, you can. Take a look at my steps below:

1. Enter the directory of the nginx configuration file (this directory is decided at the time of installation) and open it with vim editing

Vim nginx.conf

Add server_tokens off; to http {-} such as:

The copy code is as follows:

Http {

…… Omit

Sendfile on

Tcp_nopush on

Keepalive_timeout 60

Tcp_nodelay on

Server_tokens off

…… . Omit

}

2. Edit the php-fpm configuration file, such as fastcgi.conf or fcgi.conf (this configuration file name can also be customized and modified according to the specific file name):

Find:

Fastcgi_param server_software nginx/$nginx_version

Change to:

Fastcgi_param server_software nginx

3. Reload the nginx configuration:

# / etc/init.d/nginx reload

In this way, the nginx version number is completely hidden, and the nginx version will not be displayed even if there are 404,501 pages.

The modified content is as follows:

[root@hadooptest] # curl-I www.nginx.orghttp/1.1 200okserver: nginxdate: tue, 13 jul 2010 14:05:11 gmtcontent-type: text/htmlcontent-length: 8284last-modified: tue, 13 jul 2010 12:00:13 gmtconnection: keep-alivekeep-alive: timeout=15accept-ranges: bytes, that's all for "how to hide Nginx version numbers". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report