create a certificate with certbot or buy one. for this to work it needs to be in pem format
you need 2 files, fullchain certificate and privatkey, and convert them to a PCKS12 certificate with password
use openssl to convert the certificate
openssl pkcs12 -export -inkey privkey.pem -in fullchain.pem -out cert.p12 -name unifi -password pass:temppass
install certificate
openssl pkcs12 -export -inkey privkey.pem -in fullchain.pem -out cert.p12 -name unifi -password pass:temppass
restart controller
/etc/init.d/unifi restart