Nginx Configuration for Video Streaming With Secure Link

here is nginx configuration i used for a video site that have secure link.

    server {
        listen   188.40.131.92:80;
        server_name s1.video.bizhat.com;
        access_log /var/log/nginx/s1.video.bizhat.com.log;
        error_log /var/log/nginx/s1.video.bizhat.com.error_log;
        location ~ ^/media/(?[\w\-=]+,\d+)(?/.*\.flv)$ {
            secure_link $secure;
            secure_link_md5 $secure_link_expires.$file.hjAGhAJKAKAHJ89AHJ00AM;
            if ($secure_link = "") { return 403; }
            if ($secure_link = "0") { return 410; }
            alias  /home/s1.video.bizhat.com/private/$file;
            flv;
        }
        location ~ ^/media/(?[\w\-=]+,\d+)(?/.*\.mp4)$ {
            secure_link $secure;
            secure_link_md5 $secure_link_expires.$file.hjAGhAJKAKAHJ89AHJ00AM;
            if ($secure_link = "") { return 403; }
            if ($secure_link = "0") { return 410; }
            alias  /home/s1.video.bizhat.com/private/$file;
        }
    }

This video server is a storage server in vShare Youtube Clone script.

Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement