Docker, nextcloud:fpm, Nginx. Nginx-conf for two containers using /var/www/html

I want to use two different nextcloud-php-fpm-containers behind a nginx-webserver.

What is the way to do it?
The documentroot directories in the nginx-container change eg.

instance 1: nextcloud1: / var / www / html / nextcloud1
instance 2: nextcloud2: / var / www / html / nextcloud2

Unfortunately, I can not find any instructions on how to make the Nginx configuration look if the root directory of fpm-php and nginx-server is different.

I appreciate all the hints for solving using the original nextcloud: fpm containers

i would put traefik.io in front of the nginx server. like in https://github.com/ReinerNippes/nextcloud_on_docker/blob/master/roles/docker_container/tasks/traefik.yml

in case you don’t want to use traefik i guess you have to put

volume:
  - nextcloud1:/var/www/html
  - nextcloud-data1:/var/nc-data
...

and

volume:
  - nextcloud2:/var/www/html
  - nextcloud-data2:/var/nc-data
...

in the nextcloud and nginx docker config.

Hello,
thx. for your answer. I found the solution:

in the part of fastcgi:

…
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
root /var/www/html;
}

you can put the parameter of the root-directory in the php-fpm instances.