Nginx uses the limit module to set IP concurrency to prevent CC attacks

Source: Internet
Author: User

Nginx uses the limit module to set IP concurrency to prevent CC attacks in nginx. add the following line to the http field in conf: limit_req_zone $ binary_remote_addr zone = one: 10 m rate = 1r/s; # Add the following line to the average 1r/s request per second in the host definition document configured under the server (which is global under the server) limit_req zone = one burst = 8; queue mode: limit_req zone = one burst = 8 nodelay; ### do not use the default queue burst (burst is 0). If you only want to restrict php requests, add them to location ~ \. Php $ {try_files $ uri = 404; fastcgi_split_path_info ^ (. + \. php )(/. +) $; fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index. php; include fastcgi_params; limit_req zone = one burst = 8 nodelay; reload nginx to nginx-s reload reference 1: restart:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.