Slim Framework & NGINX config

I’m building an api using to Slim to access parts of the WP site I have running with Trellis. Currently I’ve placed the Slim app directory in the web directory (specifically web/api/v1) however I am unable to get the nginx config working.

Per Slim’s docs, the nginx configuration should be:

server {
    listen 80;
    server_name example.com;
    index index.php;
    error_log /path/to/example.error.log;
    access_log /path/to/example.access.log;
    root /path/to/public;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
    }
}

Am I correct in thinking that the only part of this config that I should add into roles/wordpress-setup/templates/includes.d/example.com/api.conf.j2 is:

   location / {
        try_files $uri /index.php$is_args$args;
    }

I have tried several different ways of ensuring this applies to the public directory (per the docs) without any success. For example:

   location /api/v1 {
        try_files $uri /public/index.php$is_args$args;
    }

In some cases I can see the first page of the Slim app if I go directly to the index.php file (example.com/api/v1/public/index.php) but adding any arguments to the URL just brings me to my WP 404 page.

My nginx knowledge isn’t strong so any help would be appreciated!

I Have the same issue to allow POST requests to my endpoint /app/plugins/my-plugin/. Anyone can help on this? I’am using a standard trellis/bedrock installation.