Nginx to build a live cache server

Source: Internet
Author: User

There is only one live server on the line, it is now business to give another company live broadcast, a server bandwidth can not meet, business, Director, Operations (myself) to communicate clear demand, and then on-line 3 set on the front end used as the cache ts suffix video files.

Business clear, technical problems can only be done by themselves, before the squid with the new version of the performance is not, and the configuration cumbersome, I have not configured for more than a year, many have forgotten, re-learn also spent a lot of time, and finally intend to use their familiar nginx to do.


I used to do the nginx cache is hanging Perl code, forcing the cache of the content of the major video sites, not periodically fail to delete this feature. Now this live business needs to set the cache time, the business gives a limited amount of time, a little bit clumsy; I have not configured, find Proxy_cache related information, finally finished, can cache live TS files, and automatically delete invalid files, or can meet the business.

Client_body_buffer_size  512k; proxy_connect_timeout    5; proxy_read_ timeout       60; proxy_send_timeout        5; proxy_buffer_size        16k; proxy_buffers             4 64k; proxy_busy_buffers_ Size 128k; proxy_temp_file_write_size 128k;proxy_temp_path   /data/tmp;proxy_ cache_path  /data/proxy_cache_dir  levels=1:2   keys_zone=cache1:200m  inactive=10m max_size=30g;server {        listen  192.168.1.6:80;         #server_name  ;access_log logs/ts.log   access;        location ~* /tss/vod/ {      &nbSp;  proxy_cache cache1;        proxy_ignore_headers  Set-Cookie Cache-Control;        proxy_cache_valid   200 304 10m;        proxy_cache_key  $host $uri$is_ args$args;        proxy_pass http://192.168.1.2;         proxy_set_header   Host               $host;         proxy_set_ header   x-real-ip         $remote _addr;         proxy_set_header   X-Forwarded-For   $proxy _add_x_ forwarded_for;        }

Here is a picture:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/79/9F/wKiom1aWPRaQOJ-PAAHEzjFC6so038.jpg "title=" Qq20160113200112.jpg "alt=" Wkiom1awpraqoj-paahezjfc6so038.jpg "/>

This article is from "become a cyber Security Engineer" blog, please make sure to keep this source http://luyafei.blog.51cto.com/1092421/1734767

Nginx to build a live cache server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.