This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21940|Reply: 4

[Web] Use Alibaba Cloud load balancing to block IP access to websites

[Copy link]
Posted on 5/19/2018 12:14:29 PM | | | |
Cause

Every time this site opens registration, there will be many Taiwanese IPs registered with many spam users, filling in their personal information randomly, and then replying to posts randomly, resulting in very annoyance, as shown in the figure below:



We can see that the registered IPs are all Taiwanese addresses, so I want to block this IP segment directly!

solution

Since the website backend web container uses nginx, but when users access this site, they need to go through Alibaba Cloud's load balancing, resulting in the server nginx cannot obtain the user's real IP address, that is, setting deny is invalid! Of course, there are also solutions, which are referenced below:

nginx obtains the user's real IP address
https://www.itsvse.com/thread-4776-1-1.html
(Source: Architect_Programmer)
Due to the complexity of the setup and the need to add new modules, login server settings, etc., I gave up and tried to find a solution from Alibaba Cloud's "load balancing".

The hard work pays off, although Alibaba Cloud's load balancing does not have a security group, but it has an access policy! We can configure the blacklist by accessing the policy, as shown in the figure below:



I filled in my IP address and the IP segment I wanted to block, as shown in the figure below:



#封整个段即从123.0.0.1 to 123.255.255.254
123.0.0.0/8

#封IP段即从123.45.0.1 to 123.45.255.254
124.45.0.0/16

#封IP段即从123.45.6.1 to 123.45.6.254 are commands
123.45.6.0/24



Link:https://slbnew.console.aliyun.com/

In the last step, in the load balancing listening settings, enable access control, set the blacklist mode, and select the access policy group you just created, as shown in the figure below:



Fill in your own IP address to test the effect! Our native browser accesses this website, and it cannot be accessed, and then, let others access the test, and it can be accessed and browsed normally! As shown below:






Previous:nginx obtains the user's real IP address
Next:My student number is 173104061067, and I want to find a computer god to help me retrieve my academic system password. Urgent request
Posted on 5/19/2018 8:04:40 PM |
I remember where I saw that a few days ago, someone asked to block South Korea
 Landlord| Posted on 5/20/2018 2:29:24 PM |
mapits Posted on 2018-5-19 20:04
I remember where I saw that a few days ago, someone asked to block South Korea

There are many blocking solutions, you can refer to the following:https://blog.csdn.net/leon_wzm/article/details/77715480
Posted on 7/27/2018 7:44:25 PM |
Can it be blocked?
Posted on 4/25/2019 3:01:50 PM |
Alibaba Cloud's new version of the liability balancing interface sets up an IP blacklist





Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com