Putting routing logic in Nginx seems like a architecture smell to me.
It's not nginx. It's Openresty. It's an nginx "distro". One of the main ideas behind it is adding logic on top of nginx (not only routing). This is also how Lapis works.
Actually, use nginx as a router sending traffic to different back-ends/applications based on urls is my main usage.