There's more...

Another trick we can do is to allow for an initial burst once the download starts. This is very helpful if you're streaming movie files, as it allows the initial buffer to be filled quickly and therefore allows movies to start playing as quick as possible. To add this, we can update our location block directive with one additional line:

location / {    
        limit_rate 5m; 
        limit_rate_after 20m; 
        root   /var/www/html; 
        index  index.html index.htm; 
} 

The additional limit_rate_after directive allows the download to run at full speed for the first 20 megabytes (20m), and then rate limit after this value. Many online streaming services have this implementation in place, not just to balance between the rapid start of the streaming but also to ensure that the bandwidth is fairly shared among its users.