Nginx reverse proxy, what to write in nextcloud's config.php?

When you say you’re having the exact same problem, do you mean you’re getting a redirect loop and the browser returns “ERR_TOO_MANY_REDIRECTS”?
I think it would be helpful to see the results of both the NGINX access logs and Apache access logs, so we can see what’s causing the redirect loop. Without that, we’re just doing trial and error which is extremely difficult for someone without access to the machines.