Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

  1. 这是我的2个location

image

  1. 当我访问的时候

http://localhost:8080/fad-ssp/api/ad-pos-service/adposinfo/admin/list/?current=1&size=10
发现是请求并没有匹配到.
image

  1. 然后我去查看rewrite 的实际路径, 结果发现是/api/ 匹配到了, 实在是百思不得原因.(如果将上面的两个location 互换位置,会发现, 所有的请求 /api/ 都匹配到 /fad-ssp/ 里面的location里面去了, 这个时候会造成404. )

image
请教大家一下, 我要如何隔离这两种location


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
943 views
Welcome To Ask or Share your Answers For Others

1 Answer

location ~ /abc是对URI正则表达式匹配,这意味着任何含有/abc的URI 都会匹配,你可能需要用:location ~ ^/abc来代替。这会匹配以/abc开头的所有URI。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...