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

Hide Nginx version number

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

After setting up the nginx, we will generally hide the version number of the nginx to prevent others from knowing your version number and take advantage of the vulnerability of this version to gongji your system. This will make your nginx system more secure.

Nginx displays the version number by default, such as:

D:\ curl-7.66.0-win32-mingw\ bin > curl- I a.jinxing.com

HTTP/1.1 200 OK

Server: nginx/1.6.3

Date: Wed, 23 Oct 2019 02:30:24 GMT

Content-Type: text/html

Content-Length: 22

Last-Modified: Wed, 18 Sep 2019 06:56:09 GMT

Connection: keep-alive

ETag: "5d81d509-16"

Accept-Ranges: bytes

Hidden version number method:

1. Edit the nginx configuration file

Add server_tokens off to http {-}

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:

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.

Let's test it.

D:\ curl-7.66.0-win32-mingw\ bin > curl- I a.jinxing.com

HTTP/1.1 200 OK

Server: nginx

Date: Wed, 23 Oct 2019 02:41:09 GMT

Content-Type: text/html

Content-Length: 22

Last-Modified: Wed, 18 Sep 2019 06:56:09 GMT

Connection: keep-alive

ETag: "5d81d509-16"

Accept-Ranges: bytes

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

Servers

Wechat

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

12
Report