【发布时间】:2017-02-09 20:35:17
【问题描述】:
我的 nginx 配置文件如下:
location ^~ /mount_points/mount_point1 {
internal;
alias /repos/mount_point_one;
}
location ^~ /to_proxy {
internal;
proxy_pass http://myproxy:5000;
}
当我请求“http://localhost/mount_points/mount_point1/myfile.zip”时,我按预期得到“/repos/mount_point_one/myfile.zip”。
在请求“http://localhost/to_proxy/myfile2.html”时,我得到“http://myproxy:5000/to_proxy/myfile2.html”。
在第一种情况下,“/mount_points/mount_point1”部分被删除,而在第二种情况下,“/to_proxy”部分仍然存在,我必须在上游服务器中伪造一个“/to_proxy”地址才能找到出这个。
我错过了什么吗?如果我只需要重写url,如何删除上游服务器的“/to_proxy”部分问题?
谢谢。
【问题讨论】: