Steps, in order:
1 - Create a subdomain that you want to use for the cyberpanel
2 - Go to cyberpanel ->Server status-> Change port->8443 or any of the ones that support HTTPS here:
3 - Do this step to remove the port, replacing “https://switch.cyberpanel.net:8090” with your subdomain and port, for example:
“https://sub.domain.com:8443”
4- Go to cyberpanel (using your IP:8443 or the port you changed to)->SSL->Hostname SSL->Select your subdomain->Issue SSL
5 - Go to Websites → List domains → Select your subdomain->Manage->Rewrite rules
Delete the error about “cat /…” and paste:
REWRITERULE ^(.*)$ HTTP://cyberpanel/$1 [P]
Exactly like that, don’t change anything
6 - Copy your cloudflare issued origin certificate from your main domain to your subdomain:
Your domain:
/etc/letsencrypt/live/domain.com/fullchain.pem
/etc/letsencrypt/live/domain.com/privkey.pem
Copy into your subdomain:
/etc/letsencrypt/live/sub.domain.com/fullchain.pem
/etc/letsencrypt/live/sub.domain.com/privkey.pem
7 - Go to your vps, reboot with the command:
reboot
P.S: Issuing hostname SSL will always say to enter using port 8090 because it’s a hardcoded string, just ignore, it will use your new port.