X.509 Certificates and PEM order
X.509 certificates, also commonly known as SSL certificates, are often available in text file format with file extension PEM. One benefit of using PEM is the option to have the complete certificate chain in one file, including the private key.
However the order of the certifcates (and key) is important.
-----BEGIN RSA PRIVATE KEY-----
(Your Private Key: your_domain_key.pem)
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
(Your SSL certificate: your_domain_cert.pem)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
(Your Intermediate certificate/s: InterMediateCA.pem)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
(Your Root certificate: CertificateAuthority.pem)
-----END CERTIFICATE-----
Try to avoid including the private key if the situation allows, instead keep it in a separate file, protected with a passphrase.