server {
    listen 80;
    server_name _;
    root /usr/share/nginx/html;
    #将DNS指向kubernetes集群内的DNS
    resolver kube-dns.kube-system.svc.cluster.local valid=30s;

    set $oss_endpoint_service zyos-oss.dev.svc.cluster.local:5000;
    set $endpoint_service zyos-app.dev.svc.cluster.local:5000;

    location /static {
        root /usr/share/nginx/html;
        index index.html index.htm;
    }
    location /api/qiniu {
        proxy_pass http://$oss_endpoint_service;
        proxy_set_header Connection "";
        proxy_set_header Host  $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        break;
    }
    #proxy server
    location /api {
        proxy_pass http://$endpoint_service;

        proxy_http_version 1.1;

        proxy_set_header Connection "";
        proxy_set_header Host  $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        break;
    }
}