Nextcloud setup errors

Please forgive my ignorance, but I’ve been reading the docs and trying everything suggested there to fix this, and I’m getting nowhere.

My Nextcloud is behind nginx-proxy-manager which runs on a different host than the Nextcloud container.

It seems no matter what I do, I end up with some variation of this message stating /.well-known/{webfinger,nodeinfo,carddav,caldav} are not resolved.

I can confirm the WebDAV functionality works, so as far as I can tell, this is an annoyance for me to see the errors listed there. I’d still like to get rid of them and learn something in the process if possible.

Thanks

nano config/nginx/site-confs/default.conf
location ^~ /.well-known {
# The rules in this block are an adaptation of the rules
# in .htaccess that concern /.well-known.

location = /.well-known/carddav { return 301 /remote.php/dav/; }

location = /.well-known/caldav { return 301 /remote.php/dav/; }

location /.well-known/acme-challenge { try_files $uri $uri/ =404; }

location /.well-known/pki-validation { try_files $uri $uri/ =404; }

    # Let Nextcloud's API for `/.well-known` URIs handle all other
    # requests by passing them to the front-end controller.

return 301 /index.php$request_uri;

}

location = /.well-known/host-meta { return 301 $scheme://$http_hostpublic.php?service=host-meta; }
location = /.well-known/host-meta.json { return 301 $scheme://$http_host/public.php?service=host-meta-json; }
location = /.well-known/carddav { return 301 $scheme://$http_host/remote.php/dav; }
location = /.well-known/caldav { return 301 $scheme://$http_host/remote.php/dav; }
location = /.well-known/webfinger { return 301 $scheme://$http_host/index.php/.well-known/webfinger; }
location = /.well-known/nodeinfo { return 301 $scheme://$http_host/index.php/.well-known/nodeinfo; }
}

I tried adding this to my config, but must have done something wrong. I get a 502 error and the UI doesn’t load.

For reference, this is the config I currently have which works https://termbin.com/g32x

I’m not sure where in this file i’m supposed to add these location lines.