Properly adding overwritewebroot

I have a website that runs behind a reverse proxy using NGiNX 1.18 and Let’s Encrypt SSL cert. NGiNX converts http to https and adds the www. So it is https://www.nextcloud.domain.com and Nextcloud resides in /var/www/cloud. I am confused as to how I am to write the overwritewebroot properly since this is in a subdomain and not https://www.domain.com/nextcloud.

Can anyone please help?

The best/safest way is to use occ config:system:set. See the documentation here: https://docs.nextcloud.com/server/20/admin_manual/configuration_server/occ_command.html#config-commands

You can also manually add it to your config.php.