What docker-compose for nginx on sperate host

The more I read into what to use for a docker compose the more confused it get.

What I have is a Nginx running on my Ubuntu server. I intend to run nextcloud with docker on a separate host and then reverse proxy to it from my nginx running in ubuntu.

I used the example yml


I assume this is the one i should use?
What to do next from reading around is to edit the config.php in the docker container and change the webroot, add the my nginx server ip to the trusted domains and public domain name, add my nginx server ip to a trusted proxy array and not sure on this part add a forwarded_for array?

After that its a matter of setting up my server block on nginx to get the reverse proxy working.

I tired this yesterday with Owncloud with no luck so switching to nextcloud as there are docker-compose examples with nginx for revervse proxying so thinking my luck will be better.
The main question is what setup should i use for docker in my given environment?