Nginx配置proxy_pass转发的/路径问题
在nginx中配置proxy_pass时,如果是按照^~匹配路径时,或者直接/*匹配时,要注意proxy_pass后的url最后的/,当加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径代理走;如果没有/,则会把匹配的路径部分也给代理走。
location /registry {
proxy_pass http://localhost:8001/;
access_log "logs/registry.log";
}
代理前的访问地址:http://localhost:8001
代理后的访问地址:http://localhost:8087/registry
我nginx的端口是8087