
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  logs/error.log  info;
#error_log  logs/error.log  debug;

pid        logs/nginx.pid;


events {
    worker_connections  1024;
}




http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    #
    map $http_x_forwarded_for  $clientRealIp {
    ""    $remote_addr;
    ~^(?P<firstAddr>[0-9\.]+),?.*$    $firstAddr;
    }
    log_format nginx_log_json  '{"timestamp":"$time_iso8601",'
                                '"accessip_list":"$proxy_add_x_forwarded_for",'
                                '"client_ip":"$clientRealIp",'
                                '"method":"$request_method",'
                                '"status":"$status",'
                                '"request_time":"$request_time",'
                                '"http_user_agent":"$http_user_agent",'
                                '"size":$body_bytes_sent,'
                                '"version":"1",'
                                '"client":"$remote_addr",'
                                '"url":"$uri",'
                                '"domain":"$host",'
                                '"host":"$server_addr",'   
                                '"referer":"$http_referer"'
                                 # 消息体打印
                                 # '"body":"$request_body",'
                                '}';



    access_log  log/access-json.log  nginx_log_json;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;

    upstream PKSRS {
     ip_hash;
     server 10.200.113.151:8088;
     server 10.200.113.152:8088;
     }

underscores_in_headers on; 
    server {
        listen       81;
        ## 修改为 ${server_name}: 服务器ip地址. ps: 192.144.207.84
        server_name  127.0.0.1;

        #charset koi8-r;
        client_max_body_size 1024m;
        client_body_buffer_size 1024m;

        ## 分片上传服务器配置

        location /Upload {
              ## ${ upload}: 分片上传服务器配置. ps: http://193.112.230.21
              proxy_pass	http://uploadfile.timatrix.jmrcd.com/Upload;
        }

         # live
         location /live {
             ## ${ live_ip}: 在线视频播放flv地址. ps: http://193.112.230.21
             proxy_pass	http://timatrix.jmrcd.com;
         }

         # heartbeat
         location /apps/stream {
             rewrite ^/(.*)$  /api/v1/$1 break;
             ## ${ heartbeat_ip }: 在线视频播放心跳地址. ps: http://193.112.230.21
             proxy_pass	http://timatrix.jmrcd.com/;
         }

         # 静态资源转发配置
         location /staticProxy {
              resolver 10.200.109.109 10.200.109.110;
             if ($query_string ~*  ^(.*)url=(.*)$){
                 proxy_pass $2;
             }  
         }  
        
       
        location /static/excel/ {
            client_max_body_size 1000m;
             ## ${ video-structuring-front }: 前端文件地址
            root   /data/inno-video-structuring/file;
         }

        location / {            
            add_header Cache-Control no-store;
            client_max_body_size 1000m;
             ## ${ video-structuring-front }: 前端文件地址
            root   /data/inno-video-structuring/front;
         }

         # video-structuring
         location /api {
             client_max_body_size 1000m;
             ## ${ video_structuring_ip }: 视频结构化服务地址. ps: http://localhost:10008
             proxy_pass	http://127.0.0.1:10008;
         }
   

         #callApi
         location /callApi {
             client_max_body_size 1000m;
             proxy_pass http://PKSRS//callApi;
	} 
        

	#video/playVideo
         location /video {
          client_max_body_size 1000m;
          #proxy_pass http://10.200.113.151:8088/video;
          proxy_pass http://PKSRS/video;
          proxy_connect_timeout 600;
          proxy_read_timeout  600;
          proxy_buffering off;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header     X-Forwarded-Server $host;
	}
       #video/heartbeat
        # location /video/heartbeat {
        #    client_max_body_size 1000m;
        #     proxy_pass http://10.200.113.151:8088/video/heartbeat;
	#}
        #liveflv 
         location /flvlive {
             client_max_body_size 1000m;
             #proxy_pass http://10.200.113.151:8080/live;
             proxy_pass http://PKSRS/flvlive;


	} 
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }

    server {
        listen       80;
        server_name  127.0.0.1;

        #charset koi8-r;
        client_max_body_size 1024m;
        client_body_buffer_size 1024m;


         # video-structuring
         location /innovideo/ {
             client_max_body_size 1000m;
             ## ${ video_structuring_ip }: 视频结构化服务地址. ps: http://localhost:10008
             proxy_pass	http://127.0.0.1:81/;
         }

    }

}
