Nginx stress testing and protection against malicious stress testing
Nginx Pressure Test method: # AB command # install AB # Centos system yum install apr-util # Ubuntu system sudo apt-get install apache2-utils # parameters of the AB command-n // number of requests executed in the test session. The default value is 1-c // The number of requests generated at a time. The default value is 1-T // The maximum number of seconds for testing. The default value is 1000-P // the Content-type header information used by the data file-T // POST required # instance AB-c 5000-n http://www.baidu.com/the total number of concurrent requests sent each time is. ---------------------------------------------------------------------------- # How to Set nginx to prevent stress testing: # limit the maximum concurrency of the same IP address to 10vim/etc/nginx. add the first line of the confhttp {} field: limit_conn_zone $ binary_remote_addr zone = one: 10 m; vim/etc/nginx/conf. d/defaultserver {} field added: limit_conn one 10; # restart nginxservice nginx restart # If this error message appears, it indicates nginx. limit_conn_zone $ binary_remote_addr zone = one: 10 m; # is not added to the correct region, and is added to the first line of the http field. The size 10485760 of shared memory zone "one" conflicts with already declared size 0 in/etc/nginx. conf: 33