nginx指向实时网站的API URL

时间:2017-08-01 04:23:40

标签: nginx

nginx指向实时网站的API网址

location = http://localhost:5100/services/v1/ {             proxy_pass https://test.com/services/v1/;         }

2 个答案:

答案 0 :(得分:0)

假设您打算将/ services / v1 / * api请求转发给test.com,     location / services / v1 /     {     proxy_pass https://test.com/services/v1/;     }

答案 1 :(得分:0)

确保仅在服务器块中侦听端口5100,以确保仅在5100上发生重定向。

server {
    listen 5100;
    server_name localhost;

    location /services/v1/ {
        proxy_pass https://test.com/services/v1/;
    }
}