需求描述:
所有 api.xxx.com的所有请求通过nginx代理,转向www.xxx.com/gateway-api;
问题描述:
server {
listen 80;
server_name api.xxx.com;
location / {
proxy_pass https://www.xxx.com/gatewayt-api;
}
}
代码如上配置,未生效。
解决方法:
通过观察发现,上述代码配置后,如果 请求 https://api.xxx.com/1.html经过代理变成了
https://www.xxx.com/gateway-api1.html.
于是更改配置为:
server {
listen 80;
server_name api.xxx.com;
location / {
proxy_pass https://www.xxx.com/gatewayt-api/;
}
}
再次请求,问题解决。
本文暂时没有评论,来添加一个吧(●'◡'●)