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 solve the problem of nginx Hidden version number and WEB Server Information

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces the nginx hidden version number and WEB server information how to solve the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that you read this nginx hidden version number and WEB server information problem how to solve the article will have a harvest, let's take a look at it.

Nginx can not only hide version information, but also support custom web server information.

Let's take a look at the final hidden result first.

How to achieve it? in fact, it is very simple. Please read on.

1 download the latest stable version on the official website

Wget http://nginx.org/download/nginx-1.14.1.tar.gz

2 decompression

Tar-xf nginx-1.14.1.tar.gzcd nginx-1.14.1

3 modify c file

(1) vim src/http/ngx_http_header_filter_module.c # modify line 49

Static u_char ngx_http_server_string [] = "server: please guess it!" Write your custom server information after crlf; # server

(2) vim src/http/ngx_http_special_response.c # modify 36 lines

"please guess it!" Crlf # write the string again

4 compilation configuration

. / configure-- prefix=/usr/local/nginx

5 compile and install

Make & & make install

6 modify the nginx configuration file and add server_tokens off under the http node

Vim / usr/local/nginx/conf/nginx.conf....http {server_tokens off;.

7 start nginx

/ usr/local/nginx/sbin/nginx

8 Test

[root@node1 nginx-1.14.1] # curl-I http://127.0.0.1 http/1.1 200ok server: please guess it! Date: wed, 07 nov 2018 19:15:43 gmt.

Browser access test

Description:

(1) if you only want to hide the version number and do not want to customize the server information, you do not need to perform step 3.

(2) if you need to customize the string while upgrading the nginx, you can modify the c file-- >. / configure-- > make first.

This is the end of the article on "how to solve the problem of nginx hidden version number and WEB server information". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to solve the problem of nginx hidden version and WEB server information". If you want to learn more knowledge, you are welcome to follow the industry information channel.

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