Node.js 如何使用proxypass nginx重定向url

Node.js 如何使用proxypass nginx重定向url,node.js,redirect,nginx,nginx-location,proxypass,Node.js,Redirect,Nginx,Nginx Location,Proxypass,我使用nginx-nginx作为web服务器,项目构建使用Nodejs。有两个项目,一个在6000端口上运行,另一个在7000端口上运行。 每个请求api.mysite.com将重定向到项目1(localhost:6000),请求api.mysite.com/v2将重定向到项目2(localhost:7000)。 但是,我希望请求api.mysite.com/oauth/token重定向到localhost:7000/oauth/token 在服务器块中,我有如下配置 upstream mysi

我使用nginx-nginx作为web服务器,项目构建使用Nodejs。有两个项目,一个在6000端口上运行,另一个在7000端口上运行。 每个请求api.mysite.com将重定向到项目1(localhost:6000),请求api.mysite.com/v2将重定向到项目2(localhost:7000)。 但是,我希望请求api.mysite.com/oauth/token重定向到localhost:7000/oauth/token

在服务器块中,我有如下配置

upstream mysiteapiv1 {
     server localhost:6000;
}
upstream mysiteapiv2{
     server localhost:7000;
}


server {
  listen 80;
  server_name api.mysite.com;

  root /var/www/html/v1;
  location / {
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   Host      $http_host;
     proxy_pass         http://mysiteapiv1;
  }

  location /v2 {
     proxy_set_header   X-Real-IP $remote_addr;
     proxy_set_header   Host      $http_host;
     proxy_pass         http://mysiteapiv2;
  }

  location /oauth/token {
    #  proxy_set_header   X-Real-IP $remote_addr;
    #  proxy_set_header   Host      $http_host;
       proxy_pass         http://localhost:7000/oauth/token;
  }


  location /public/ {
       try_files $uri $uri/ =404;
  }
}
但找不到请求api.mysite.com/oauth/result
我该怎么办?

您的
http://localhost:7000/oatuh/token;。但是URI不是必需的,因为
http://localhost:7000
应该也能正常工作。有关详细信息,请参阅。谢谢@RichardSmith,使用api.mysite.com/v2,但我希望api.mysite.com/oauth/token将重定向到