Nginx learns how to prevent traffic attacks
scenes to be used Recently, the related configuration of the report query system load balancing cluster has been completed. The two implementation methods are session management strategies based on Ehcache and Redis respectively. We all know that server resources are limited, but requests from clients are unlimited (malicious attacks are not ruled out). In order to ensure that most requests can be responded normally, some requests from clients have to be given up, so we will use Nginx Current limiting operation, this operation can relieve the pressure on the server to a great extent, so that other normal requests can be responded normally. How to use Nginx to implement basic current limiting, such as limiting a single IP to 50 visits per second. Through the Nginx current limiting module, we can set that once the number of concurrent connections exceeds our setting, a 503 error will be returned to the client. This can be very effective in preventing CC attacks. Combined with the iptables firewall, basically CC attacks can be ignored. how to use conf configuration #Unified configuration in the http domain #Limit requests limit_req_zone $binary_remote_addr $ uri zOne=api_read:20m rate=50r/s; #Configure a connection zone by ip limit_conn_zone $binary_remote_addr zOne=perip_conn:10m; #Configure…