我想访问本地网站的指定uri时,实际访问的是另一网站,于是使用了nginx作为代理
nginx相关配置如下
server {
listen 80; server_name www.example.com; ..... location /foo/ { proxy_store off; proxy_redirect off; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Referer 'no-referrer-when-downgrade'; proxy_set_header User-Agent 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebkit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36'; proxy_pass https://api.example.com/foo/; }
}
nginx 启动时报错 host not found in upstream 'api.example.com'