Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
How to redirect url with proxypass nginx

I use nginx Nginx as web server, and project build use Nodejs. There are 2 Project, one run on port 6000 and another on port 7000. Every request api.mysite.com will redirect to project 1 (localhost:6000), and request api.mysite.com/v2 will redirect to project 2 (localhost:7000). But,I want request api.mysite.com/oauth/token redirect to localhost:7000/oauth/token

In the server block , I have configure like this

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

But request api.mysite.com/oauth/ resulted not found What should I do ?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!