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 $foo'; # access_log logs/access.log main; # access_log off; sendfile on; tcp_nopush on; keepalive_timeout 0; #keepalive_timeout 65; init_by_lua_file conf/init-disk.lua; upstream hls01.ott.disp.cibntv.net { server 221.174.120.85; } proxy_temp_path /data/proxy_temp; proxy_store on; proxy_store_access user:rw group:rw all:r; server { listen 80; listen 8088; server_name localhost; access_log logs/disp.access.log main; set_by_lua $dpath 'return ffi.string(dpath.get_dpath(ngx.var.request_uri));'; location ~* \.(m3u8|ts|aac|xml)$ { default_type text/html; if ( -f /export/$dpath/$uri ) { rewrite ^/(.*) /$dpath/$1 break; } error_page 404 = @allhls; root /export; index index.html; } location @allhls { ###crtc### proxy_pass http://unix:/tmp/nginx.sock; proxy_set_header Host hls01.ott.disp.cibntv.net; #proxy_set_header Addr 221.174.120.66; proxy_set_header Dpath $dpath; set $allhls "allhls"; proxy_set_header X_Real_IP $remote_addr; } location @redira { set $foo $upstream_http_location; proxy_pass $foo; proxy_set_header X_Real_IP $http_x_real_ip; } #location = /302.html { # root html; #} 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; } } server { listen unix:/tmp/nginx.sock; access_log logs/access.log main; location / { proxy_intercept_errors on; proxy_pass http://hls01.ott.disp.cibntv.net; proxy_set_header Addr 221.174.120.66; proxy_set_header Dpath $http_dpath; proxy_set_header X_Real_IP $http_x_real_ip; error_page 301 302 307 =200 @redira; } location @redira { root /export/$http_dpath; set $foo $upstream_http_location; proxy_pass $foo; proxy_set_header X_Real_IP $http_x_real_ip; } } }