Skip to content
Snippets Groups Projects
Commit f3e1446a authored by Florent Thiery's avatar Florent Thiery
Browse files

fixup indentation (spaces), restore use stale

parent 773b0736
No related branches found
No related tags found
No related merge requests found
proxy_cache_path /tmp/nginx-uc-cache levels=1:2 keys_zone=uc-cache:10m max_size=10g inactive=300s;
server {
listen 80 default_server;
listen 443 default_server ssl;
server_name {{ server_name }};
listen 80 default_server;
listen 443 default_server ssl;
server_name {{ server_name }};
root /var/www/cache/;
root /var/www/cache/;
access_log /var/log/nginx/access_cache.log;
error_log /var/log/nginx/error_cache.log;
access_log /var/log/nginx/access_cache.log;
error_log /var/log/nginx/error_cache.log;
location /crossdomain {
}
location /crossdomain {
}
location /streaming/ {
# Live
location ~ \.m3u8$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
# ignore upstream headers
location /streaming/ {
# Live
location ~ \.m3u8$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
# serve from cache while updating
proxy_cache_use_stale updating;
# ignore upstream headers
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
proxy_ignore_headers Cache-Control;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
proxy_ignore_headers "Cache-Control" "X-Accel-Expires" "Expires";
# hide upstream X-Cache header
proxy_hide_header X-Cache;
proxy_hide_header X-Cache;
# add own X-Cache header
add_header X-Cache $upstream_cache_status;
add_header X-Cache $upstream_cache_status;
# m3u8-specific
# how long should the data be kept in this cache
proxy_cache_valid 200 2s;
# instruct browsers never to cache m3u8
expires -1;
}
location ~ \.ts$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
# ignore upstream headers
# how long should the data be kept in this cache
proxy_cache_valid 200 2s;
# instruct browsers never to cache m3u8 max 1s
expires 1s;
}
location ~ \.ts$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
# serve from cache while updating
proxy_cache_use_stale updating;
# ignore upstream headers
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
proxy_ignore_headers Cache-Control;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
proxy_ignore_headers Cache-Control;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
# hide upstream X-Cache header
proxy_hide_header X-Cache;
proxy_hide_header X-Cache;
# add own X-Cache header
add_header X-Cache $upstream_cache_status;
add_header X-Cache $upstream_cache_status;
# ts-specific
# how long should the data be kept in this cache
proxy_cache_valid 200 10s;
# instruct browsers to cache this for 6s
expires 6s;
}
}
location /resources/ {
# VOD
location ~ \.(m3u8|ts|mp4|mp3|oga|ogv|ogg|mov|flv)$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
proxy_cache_min_uses 1;
proxy_cache_use_stale updating;
# how long should the data be kept in the cache
proxy_cache_valid 200 7d;
# instruct browser to cache this
expires 7d;
# headers
proxy_ignore_headers Cache-Control;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
add_header X-Cache $upstream_cache_status;
}
}
location / {
# only urls to video and audio files are allowed, discard any requested path for other urls
rewrite ^/(.*)$ /index.html? break;
}
# how long should the data be kept in this cache
proxy_cache_valid 200 10s;
# instruct browsers to cache this for 6s
expires 6s;
}
}
location /resources/ {
# VOD
location ~ \.(m3u8|ts|mp4|mp3|oga|ogv|ogg|mov|flv)$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass {{ source_server }};
proxy_cache uc-cache;
# do not consider secure urls as new files
proxy_cache_key $scheme$proxy_host$uri;
# only one request at a time will be allowed to populate a new cache element
proxy_cache_lock on;
proxy_cache_min_uses 1;
proxy_cache_use_stale updating;
# how long should the data be kept in the cache
proxy_cache_valid 200 7d;
# instruct browser to cache this
expires 7d;
# headers
proxy_ignore_headers Cache-Control;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
add_header X-Cache $upstream_cache_status;
}
}
location / {
# only urls to video and audio files are allowed, discard any requested path for other urls
rewrite ^/(.*)$ /index.html? break;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment