Part 1: Cloudflare setup
Add your domain to Cloudflare and replace your registrar nameservers with Cloudflare nameservers.
Why this setup matters
Cloudflare gives you DNS, SSL, and a layer of protection, but LemonHost still needs the request to reach the right origin port. If the DNS or origin rule is off by even one setting, the domain may load inconsistently or fail completely.
Create DNS record
- Type: A
- Name: @
- IP: your LemonHost server IP
- Proxy status: enabled
Set SSL mode
Go to SSL/TLS overview and set mode to Flexible.
Part 2: Fix the random port issue
LemonHost servers often run on random ports. Cloudflare does not route arbitrary ports by default, so you must add an origin rule.
Create origin rule
- Go to Rules, then Origin Rules, then Create Rule.
- If Hostname equals yourdomain.com.
- Then rewrite port to your LemonHost server port.
Deploy the rule and wait one to two minutes before testing https://yourdomain.com.
Troubleshooting
- Error 521 usually means wrong origin port mapping.
- Timeouts usually mean the server is down or IP/port is incorrect.
- Confirm proxy remains enabled in DNS.
Quick verification checklist
- DNS record points to the correct server IP.
- Cloudflare proxy is enabled for the record.
- SSL mode matches the origin setup.
- Origin rule rewrites to the exact LemonHost port.
- The server is online before you test the domain.