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 prevent Nginx from being maliciously parsed by domain name

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "how to prevent Nginx from being maliciously resolved by domain names". In daily operation, I believe many people have doubts about how to prevent Nginx from being maliciously resolved by domain names. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "how to prevent Nginx from being maliciously resolved by domain names". Next, please follow the editor to study!

Mainly due to the lack of the following configuration code: nginx version 1.8.0

Server {listen 80 default_server; server_name _; return 403;}

Let all unconfigured server_name return 403 error

I haven't added this configuration to nginx before, but I haven't encountered this kind of problem again, and I tested it on another server, and even without this code, it's impossible to parse and request successfully, very speechless.

Add:

After searching around, I found that nginx had better use its own unique status code 444 for this kind of problem.

Server {listen 80 default_server; server_name _; access_log off; return 444;}

In this way, when accessed on the browser side, the browser will automatically prompt the user that the user cannot access it.

The result crawled through curl (output http error message)

At this point, the study on "how to prevent Nginx from being maliciously parsed by domain names" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report