url rewrite, nginx throw 404 errors, nothing in error logs
Solution 1:
First, move the key rewrite out of the location
block into the enclosing server
block. That will simplify your logic.
Next, enable rewrite debug logging to confirm if the 404 you are getting is from the original URL, or the rewritten URL.
Finally, if the root cause is still not found enable general debug logging for Nginx:
error_log /path/to/log debug;