Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Limit the use of the request being Nginx Flood attack     - Git Tutorial Comments (Linux)

- Install Krita 2.8 on Ubuntu 13.10 / 12.04 / 12.10 (Linux)

- How to view the Linux graphics hardware information (Linux)

- Spark build standalone version cluster (Server)

- Binary Tree Traversal (Linux)

- Top 10: HTML5, JavaScript 3D game engine and framework (Linux)

- After the first remote installation GlassFish Web to remotely access their back office management system error solution appears (Server)

- Experience PHP 7.0 on CentOS 7.x / Fedora 21 (Server)

- Linux System Getting Started Learning: Debian download, installation and graphical interface (Linux)

- Mac Docker deploy development environment (Server)

- Zabbix configuration of SNMP (Server)

- Git version rollback (Linux)

- Btrfs file system creation and their characteristics in Linux (Linux)

- GoldenGate update is missing (Database)

- Use innobackupex full realization of MySQL hot backup (Database)

- To achieve a two-way static NAT stateless available modules on Linux (Linux)

- Ubuntu 13.04 configure MyEclipse 10.7 Environment (Linux)

- Android imageView in the Src and Background (Programming)

- Linux Command - ps: a snapshot of the current process (Linux)

- What have we learn from the front-end application Nodejs (Programming)

 
         
  Limit the use of the request being Nginx Flood attack
     
  Add Date : 2018-11-21      
         
         
         
  Test

I will simply tell you how to configure request restrictions Nginx module and it is how to protect your site, you are attacked and prevent DDOS or other HTTP-based denial of service attacks.

For this test, I would like to save the page in Blitz.io (now free service) named about.html, for testing limit_req instructions.

First, I use the following command in the Blitz, to initiate and 1075 concurrent requests for one minute, the response timeout to two minutes, the California region, and set the state to get rid of all the state 200 other than an abnormal state, even 503 are not considered to be successful.

-p 1-1075: 60 --status 200 -T 2000 -r california http://kbeezie.com/about.html


Not too bad, right? But if it is a php file. It might cause users 502/504 status PHP process, so that the server has crashed or unresponsive. Especially if you do not use any protection or other VPS cheap servers, the failure rate will be higher. (Original ad, here shield)

Of course, you can use the cache or other tools to improve server performance and response capability, for example, you can use WordPress you definitely want to use wordpress caching plugin. Da For those type of people we can use the limit request module.

In Nginx we create a regional http {}, I told him to blitz set 5 requests per second, the maximum data capacity of 10MB. I use as a session variable $ binary_remote_addr let yourself than normal visitors $ remote_addr can access greater than 10MB Space.

limit_req_zone $ binary_remote_addr zone = blitz: 10m rate = 5r / s;
However, the definition of weeks in the server on these rules:

location = /about.html {
limit_req zone = blitz nodelay;
}

Then reload Nginx configuration

You will find only more than 285 people now have access to the server, the number of requests per second at 4.75, we set no more than 5 times per second, check the log you will find no access to the requests are HTTP 503, access to all HTTP 200.

Such an arrangement would like to use for access to restricted areas is helpful, it can also be applied on all php requests.

PHP application requests limit

If you want to restrict all PHP application limits, you can do this:

location ~ \ .php {
limit_req zone = flood;
include php_params.conf;
fastcgi_pass unix: /tmp/php5-fpm.sock;
}
It can help you stuff some settings like acceleration or deceleration, in order to deal with unexpected demand or configuration item details without delay, hit here:. HttpLimitReqModule.

Note:

You may notice that the chart above test 1075 user requests, here are misleading, because all access requests are from California and located in the same IP (50.18.0.223).

I find it difficult to achieve a real high-traffic network or DDOS (distributed denial of service attack). This is why we are the number of users with access to a successful IP is not great. Test server load also affect the user's access number or region. the number of users you can use the free version is the maximum concurrent access to 50. of course, you can spend $ 49 per day US knife allows 1000 users to access your site.

If you have enough memory with bandwidth of a single IP address test is very easy to use this tool can be achieved: high concurrency, ab, openload etc. is only in the terminal interface, it is no UI.

Of course, you want to test yourself, remember to use status flag, because the Blitz in about 5 seconds after the response to the access request.

Better alternatives

There will not be further explained in more detail, if you seriously want to prevent DDOS attack your server or multi-service attack, there are other great software tools like iptables (linux), pf (packet filter for BSD), or you the server hardware, you can use your hardware firewall. above limitation module will stop coming through HTTP request flood attack, it does not prevent ping packet flooding attacks or other vulnerabilities in these cases you can turn off unneeded services and ports not needed to prevent others breakthrough.

For example, my server external network ports open only HTTP / HTTPS and SSH. Like these services bind local MySQL connections also some common service can be set to the port is not commonly used, so as not to be sniffed filter (iptables / pf this case would be helpful).
     
         
         
         
  More:      
 
- Ubuntu 14.04.02 LTS startup items erroneous writing / dev / sda1 (win 7 loader) Repair (Linux)
- CentOS 6.5 installation VNCServer implement graphical access (Server)
- Deploy Apache Spark cluster environment in Ubuntu (Server)
- You really do need to know a variety of programming languages (Programming)
- Nodejs mysql pool Example (Programming)
- PHP 7.0 Upgrade Notes (Linux)
- 8 Git tips (Linux)
- Swift notes - let you two hours to learn Swift (Programming)
- Java MVC CRUD examples (Programming)
- Spring use Cache (Programming)
- To use yum install VLC under CentOS (Linux)
- Linux automatically install service components and optimize the kernel parameters (Linux)
- Docker command Detailed (Linux)
- Java Concurrency - multiple threads of HelloWorld (Programming)
- CentOS 7 source code to compile and install PHP5.6 Nginx1.7.9 and MySQL (LNMP build environment) (Server)
- Bitmap memory footprint of computing Android memory optimization (Linux)
- Analysis of Java exception (Programming)
- CentOS yum source as the default setting methods in DVD (Linux)
- Linux command Detailed chpasswd bulk edit user password (Linux)
- Linux environment variable configuration and save places (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.