
user  root;
worker_processes  4;

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

#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;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
   client_max_body_size 500M;


    #gzip  on;

    # ##################HTTP server app show environment  START ######################################
    #
    server {
        listen       8999;
        server_name  energyService;

        location / {
            root   html/dist-show/;
            index  index.html;
            try_files $uri $uri/ /index.html =404;
            client_max_body_size 500M;
        }

        location /api/{
            proxy_pass http://192.168.50.235:16500/;
            #客户端真实ip
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        }

       location /tiles {
            alias /data/roadmap;
            autoindex on;
            expires 30d;
            access_log off;
            add_header Cache-Control "public";
        }

  location /transDataWeb/ {
            proxy_pass http://192.168.50.241:9002/;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host $host;  # 传递原始请求的主机头
        }

   location /ETLapi/ {
            proxy_pass http://192.168.50.241:9002/;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host $host;  # 传递原始请求的主机头
        }


        location /WZLapi/ {
            proxy_pass http://192.168.50.241:9002/; # 将请求代理到后端服务
            rewrite ^/WZLapi/(.*)$ /$1 break;  # 将 /sAlgorithm 重写为后端接受的路径
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }


        location /WJapi/ {
            proxy_pass http://192.168.50.235:8888/; # 将请求代理到新的目标地址
           # rewrite ^/WJapi/(.*)$ /$1 break;  # 将 /WJapi 重写为后端接受的路径
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }


       location /ImportData/ {
            proxy_pass http://192.168.50.241:8001/;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host $host;  # 传递原始请求的主机头

       }

     #自定义分析前端弄nodejs
        location /databaseApi/ {
            proxy_pass http://192.168.50.234:3000/; # 假设后端服务也是监听80端口
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        #自定义分析算法服务
        location /sAlgorithm/ {
            proxy_pass http://192.168.50.235:8666/; # 将请求代理到后端服务
            rewrite ^/sAlgorithm/(.*)$ /$1 break;  # 将 /sAlgorithm 重写为后端接受的路径
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        error_page   500 502 503 504  /50x.html;
            location = /50x.html {
            root   html;
        }

    }

    # ##################HTTP server app show environment  END   ######################################

}
