Optimize nginx stream

shahzaib shahzaib shahzaib.cb at gmail.com
Sat Jan 19 13:31:15 UTC 2013

we're running high traffic streaming website similar to youtube, due to
large number of streams on daily basis, our server is consuming 10~12TB
bandwidh per day. We're using nginx-1.2.1 and want to restrict users to
download videos but don't want to restrict streams from our website. We
also tried "limiting download connections per ip (limit_conn addr 1), but
the problem is if 2~3 users are streaming videos from our site on same Lan
with single ip, the stream will stop working for 2 others and will display
(stream not found) error .I am newbie to nginx, can anyone help me on
optimizing bandwidth security for nginx? My particular host config settings
are given below :-

limit_conn_zone $binary_remote_addr zone=addr:5m;
server {
        listen  80;
        server_name  content.com;

        client_max_body_size 800m;

        limit_rate 100k;
    #    access_log  /websites/theos.in/logs/access.log  main;

        location / {
            root   /var/www/html/site;
            index index.html index.htm index.php;

location /files/videos {
            root   /var/www/html/site;
               limit_conn addr 1;

location ~ \.(flv)$ {
                root /var/www/html/site;
                limit_conn addr 1;
                 valid_referers none blocked content.com;
                if ($invalid_referer) {
                    return   403;

I think the above config is enough to identify the issue. please let me
know if you understand about what i am trying to explain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130119/a27ff2df/attachment.html>

More information about the nginx mailing list