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 (port 6000), and request api.mysite.com/v2 will redirect to project 2 (port 7000).
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/oatuh/token;
}
location /public/ {
try_files $uri $uri/ =404;
}
}
But request api.mysite.com/oauth/ resulted not found What should I do ?
via Fransiscus Manihuruk
No comments:
Post a Comment