How to fix AH02565: Certificate and private key do not match
The private key must match with the certificate('s public key) you use. Otherwise you won't be able to use them together.
One way to make sure both key and certificate match (certificate comes from the private key being used) is by checking their modulus with openssl.
openssl rsa -in file.key -noout -modulus
openssl x509 -in file.crt -noout -modulus
Note: If certificate or key are not in ASCII you must add "-inform DER" to the specific file.
The output of both commands must be the same.