Limit_rate for different resolutions !!

shahzaib shahzaib shahzaib.cb at gmail.com
Mon Jul 22 04:27:59 UTC 2013


hello,

>Changing the "mp4" location to be "~ -720\.mp4$" means that those ones
>will have the higher rate; but if you don't have a second location{}
>for the other mp4s, they won't see the "mp4" directive, and so may not
>be served correctly.

Yes, i've created different block locations for mp4 files and every mp4
file is working fine, you can check the config below and let me know if
there's anything wrong you see ?

location ~ -720\.(mp4)$ {
                mp4;
                expires 7d;
                limit_rate 500k;
                root /var/www/html/videos;
                 valid_referers none blocked  domain.com;
                if ($invalid_referer) {
                    return   403;
                }
                }
location ~ -480\.(mp4)$ {
                mp4;
                expires 7d;
                limit_rate 250k;
                root /var/www/html/videos;
                 valid_referers none blocked  domain.com;
                if ($invalid_referer) {
                    return   403;
                }
                }
location ~ \.(mp4)$ {
                mp4;
                expires 7d;
                root /var/www/html/videos;
                 valid_referers none blocked  domain.com;
                if ($invalid_referer) {
                    return   403;
                }
                }




On Mon, Jul 22, 2013 at 1:13 AM, Francis Daly <francis at daoine.org> wrote:

> On Sun, Jul 21, 2013 at 02:29:26PM +0500, shahzaib shahzaib wrote:
>
> Hi there,
>
> > Well the rate_limit was 180K before for all the files because i added it
> > into the server{} block and these location blocks were actually means the
> > rate_limit 180k will apply to any flv,mp4,jpeg file and after adding -720
> > before the location ~\.(mp4)$, the only 720p files will be served on
> > limit_rate 500k and the rest would remain the same which is 180k in my
> case.
>
> Good stuff -- each directive has a meaning, and if you wanted most
> requests to have the 180 rate limit, then you put it in the right place.
>
> Changing the "mp4" location to be "~ -720\.mp4$" means that those ones
> will have the higher rate; but if you don't have a second location{}
> for the other mp4s, they won't see the "mp4" directive, and so may not
> be served correctly.
>
> > I didn't used curl instead wget.
>
> That's fine -- wget does a similar task to curl; and it's always good
> to be able to demonstrate that the change you made fixed what was broken
> (and didn't break what was already right).
>
> Cheers,
>
>         f
> --
> Francis Daly        francis at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130722/21e266fa/attachment.html>


More information about the nginx mailing list