I have looked at this a few times now and I can’t actually work out what the issue is, So you could if you wanted to set up a certificate and configure n8n to use it but you have Nginx Proxy Manager which can already do it.
At the moment on my home setup I am using Cloudflare for DNS and I have that going to nginx proxy manager and I use Lets Encrypt in Proxy Manager and it is working great. Is there something specific stopping you from taking this approach? It just seems like an overly complicated setup to do.
The 502 error is probably down to a configuration issue and could be that you need to change something in nginx proxy manager or you have an environment option set that is doing something odd.