How do you connect your domain from cloudflare to amp localhost?

OS: Ubuntu lastest
Problem: trying to connect my domain to localhost, when i type bash <(wget -qO- getamp.sh) postSetupHTTPS and say my domain it gives me this error

Bad domain configuration.
The specified domain x resolves to 'a' but your external IP is 'b'.

Im using cloudflare for my domain. Ive also tried

ampinstmgr setupnginx domain x 8080

but that gives me this error

Encountered exception during recovery: certbot.errors.MisconfigurationError: nginx restart failed:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)

I dont know why its so hard to forward a domain on amp cubercoder when other hosting sites you setup yourself is extremly easy even with cloudflare.

The automatic HTTPS setup does not support cloudflare. Your sub domain must point directly to the server.

How would i do this?
If i do

ampinstmgr setupnginx sub.domain.com 8080

or

bash <(wget -qO- getamp.sh) postSetupHTTPS and put sub.domain.com

It gives me the same errors as before

Make sure your subdomain points to your servers IP as the script shows, not to cloudflare. It’s not difficult at all. You don’t need to involve Cloudflare to use AMP. If you want to then you don’t use AMPs automatic HTTPS setup.

Im very new to hosting and stuff and if i dont need to us amps automatic https setup, how would i then do it?

Just say no when it asks you that and carry on. Anything outside of AMP is beyond the scope of the support we provide.

Ideally though, don’t use cloudflare with AMP. We don’t offer any official support for it, so if you don’t know how to use it for DNS only then we can’t assist you.