cURL error 60: SSL certificate problem: self-signed certificate

I’m having hard time to understand your architecture. Sounds you are running CODE on bare-metal but it’s unclear if you use or not a reverse proxy. If there is a reverse proxy (with SSL offloading) in place you should ensure (curl -v) your Nextcloud connects to the reverse proxy and not to the CODE application itself - this way it will utilize proxy cert and the problem should disappear.

please review 101: Split-Brain DNS (split-horizon) and Collabora integration guide