Thanks, Stevenzhu.
I changed the Nginx config and add the server_name and NC page did not load (error 502) and I got the same invalid cert. I enabled CF’s DNS + HTTP proxy, the cert is also invalid with the same error 502 (bad gateway). I changed the Nginx config back to nextcloud.* and this time cert is valid but still getting error 502. Driving me nuts!