user nobody; worker_processes 8; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; pid logs/nginx.pid; worker_rlimit_nofile 204800; events { worker_connections 102400; use epoll; } http { include mime.types; default_type text/html; log_format main '$remote_addr - $server_port $host [$time_local] "$request" ' '$status $body_bytes_sent $request_time ' '"$http_user_agent" "$http_x_forwarded_for" $dpath $allhls '; sendfile on; tcp_nopush on; keepalive_timeout 0; init_by_lua_file conf/init-disk.lua; upstream cnc { server 172.16.11.83; #server 114.247.94.25; #server 124.127.46.73 backup; } upstream tc { server 124.127.46.73; } upstream crtc { server 211.103.207.119; } proxy_temp_path /data/proxy_temp; server { listen 80; listen 8088; server_name localhost; access_log logs/hls.log main; set_by_lua $dpath 'return ffi.string(dpath.get_dpath(ngx.var.request_uri));'; location ~* \.(m3u8|ts|aac)$ { default_type text/html; proxy_set_header Host hls01.ott.disp.cibntv.net; proxy_set_header Dpath $dpath; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_store on; proxy_store_access user:rw group:rw all:r; if (!-f $request_filename){ proxy_pass http://cnc; set $allhls "allhls"; } root /export/$dpath; index index.html; } location ~* /favicon\.ico$ { echo "x"; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /cibn/getcip { echo $remote_addr; } location /server-status { stub_status on; access_log off; allow 127.0.0.1; allow 10.0.0.0/9; allow 192.168.0.0/16; deny all; } } }