【发布时间】:2022-03-29 18:56:28
【问题描述】:
我正在尝试将 api 请求代理到远程 api 服务器 (https://api.domain.com) 这是我的 nginx 配置
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name dev.domain.com;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8080;
}
location /api/ {
proxy_pass https://api.domain.com;
}
但我得到了错误
no live upstreams while connecting to upstream, client: x.x.x.x, server: dev.domain.com, request: "GET /api/current_ip HTTP/1.1", upstream: "https://api.domain.com/api/current_ip", host: "dev.domain.com", referrer: "https://dev.domain.com/api/current_ip"
我不明白我的配置中遗漏了什么。
【问题讨论】:
标签: nginx reverse-proxy proxypass