Nginx configuration with WordPress (or any subsite) in a subdirectory

We just spent entirely too much time trying to figure out this nginx configuration with Kirby in the web root and a WordPress install in a subdirectory, so I figured I’d share the solution here: https://www.digitalocean.com/community/questions/nginx-with-kirby-cms-at-web-root-and-wordpress-in-a-subdirectory

The main nginx configuration is based off of this gist, and the issue was that there needed to be an additional if (!-e $request_filename){ block before the final one. That makes it so the subsite can try its own index.php file before going to the Kirby index.php. It works well with WordPress, but the basic idea should work with any CMS or subdirectory that does its own URL rewriting (which is why it works for the Kirby panel!).