Angular nginx转发问题帮助,localhost工作,但不是ip地址

Angular nginx转发问题帮助,localhost工作,但不是ip地址,angular,nginx,nginx-location,Angular,Nginx,Nginx Location,我有nginx网站。在本地运行时,localhost一切都按计划工作。然而,当我部署到另一台服务器时,我得到了坏网关。在nginx我有这个 server { listen 80; server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm; } location ~ /api/(.*) { resolver 12

我有nginx网站。在本地运行时,localhost一切都按计划工作。然而,当我部署到另一台服务器时,我得到了坏网关。在nginx我有这个

server {
    listen 80;
     server_name localhost;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
  }

  location ~ /api/(.*) {
    resolver 127.0.0.11 ipv6=off valid=1s;
      set $upstream api;

      proxy_pass http://$upstream:63415/api/$1;
  }
}
当我在本地运行时,从web应用程序到localhost/api/company的调用被路由到$1,但当我部署到另一台服务器时,我得到的是坏网关。502坏网关,fyi 8088是docker公开的端口,映射到nginx容器内的端口80。下面是如何定义前端服务的

private companiesUrl = '/api/companies/';  // URL to web API
  constructor(private http: Http) { }

  getCompanies(): Promise<Array<Company>> {
     return this.http
        .get(this.companiesUrl)
        .toPromise()
        .then((response) => {
          return response.json() as Company[];
        })
        .catch(this.handleError);
  }
private companyesurl='/api/companys/';//web API的URL
构造函数(私有http:http){}
getcompanys():承诺{
返回此文件。http
.get(this.companyesURL)
.toPromise()
。然后((响应)=>{
将response.json()作为Company[]返回;
})
.接住(这个.把手错误);
}
有人能帮我修复nginx配置吗。我想这就是问题所在