linux - How to limit file download speed?
欧阳克
欧阳克 2017-06-27 09:18:22
0
1
1363

There is now a file download server of HTTP, which has currently limited the download speed of single thread. The speed is 200kb/s but if the user uses multi-threading to download, such as Thunder. You can break through the limitations and achieve double the effect. May I ask how centos can limit the speed above?

欧阳克
欧阳克

温故而知新,可以为师矣。 博客:www.ouyangke.com

reply all(1)
曾经蜡笔没有小新

You can use nginx’s limit_conn_module to limit the number of client IP connections.
The following is a simplified configuration:

http {
    limit_conn_zone $binary_remote_addr zone=addr:10m;

    server {
        limit_conn addr 1;
    }
}
  • limit_conn_zoneDefine a bucket that limits connections;

  • $binary_remote_addr means to calculate the number of connections based on the client IP as the key;

  • zone=addrDeclare the name of this bucket;

  • limit_conn executes a limit on the number of connections, and the following addr is to call the previously configured bucket.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template