在配置文件nginx.conf的http{}添加:
1
| limit_zone one $binary_remote_addr 10m;
|
在location url重写配置里添加:
1 2
| limit_conn one 5; limit_rate 50k;
|
如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| http{ ............. limit_zone one $binary_remote_addr 10m; .............. server{ ................. location { ......... limit_conn one 5; limit_rate 50k; ........ } ................. } ............. }
|
测试:
限制前:

限制后
