nginx的location转发目前设定为 /test 和 /test/abc ,proxy_pass http://proxy/xy/ ,若使用/test/a访问,实际的地址是多少
时间: 2023-06-04 20:07:54 浏览: 71
实际地址为 http://proxy/xy/a。因为 nginx 的 location 匹配规则为前缀匹配,匹配到 /test/abc 后会将请求转发到 http://proxy/xy/abc,同理匹配到 /test 也会转发到 http://proxy/xy。因此,使用 /test/a 访问时,匹配到 /test 后会将请求转发到 http://proxy/xy,路径为 /a。
相关问题
nginx的location转发目前设定为 /test/ab 和 /test/abc ,访问/test/a,会使用哪个转发
规则?
根据nginx的匹配规则,/test/a会先匹配/test/ab,如果匹配不到则再匹配/test/abc。所以,如果/test/a既不匹配/test/ab也不匹配/test/abc,将会使用默认转发规则。
location /app/{ proxy_pass http://192.168.10.9:9134/test/;
location /app/ {
proxy_pass http://192.168.10.9:9134/test/;
}
这是一个Nginx的配置项,用于将请求转发到指定的后端服务器。具体解释如下:
- `location /app/`:表示匹配以`/app/`开头的URL路径。
- `proxy_pass http://192.168.10.9:9134/test/`:表示将匹配到的请求转发到`http://192.168.10.9:9134/test/`这个后端服务器。