Indeed, as you have found NGiNX tests a request URI against all defined location blocks and stops when it’s found one that matches. After that any remaining location won’t be processed anymore. This can be quite annoying, but it’s possible to work around, as you’ve shown
Yes, annoying is putting it lightly. I literally had to prove that rewrite with .j worked, and .jp worked, but debunked on .jpg. nginx has been a huge learning curve for me, and I’ve recently changed all our rewrite rules, which has added to the confusion.
Yes if you’re used to Apache it’s quite a step to get your head around NGiNX. I do feel it’s worth it though, because in the end the syntax does make a lot more sense than Apache’s, plus NGiNX is a heck of a lot more stable and faster than Apache.
Lol, well that is very true too. And there are a lot of things I do love about nginx in terms of the settings (and the fact that my server now stays up).