search

Home  >  Q&A  >  body text

linux - How to limit file download speed?

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?

欧阳克欧阳克2785 days ago1430

reply all(1)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-27 09:20:22

    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.

    reply
    0
  • Cancelreply