Private key does not match public key

After a couple retries, I realized I have restarted my server too much with Docker. I had Volume setup but I had dropped the volume so many times that I ended up getting rate limit exceeded with letsencrypt. This was not good as my website has been down for a day now.

In desperate times, I created my own SSL certs with Namecheap from comodo.com.

I followed the instructions and did

openssl req -new -newkey rsa:2048 -nodes -keyout clashleaders_com.key -out clashleaders_com.csr

I submitted those to namecheap.com and received a zip file via email. My zip file had

www_clashleaders_com.ca-bundle www_clashleaders_com.crt www_clashleaders_com.p7b

So far good.

I created a bundle doing

cat www_clashleaders_com.crt www_clashleaders_com.ca-bundle > ssl-bundle.crt

And changed my Caddyfile to

tls /etc/caddy/ssl-bundle.crt /etc/caddy/clashleaders_com.key

I get this error

/etc/Caddyfile:4 - Error during parsing: Unable to load certificate and key files for ‘https://www.clashleaders.com’: tls: private key does not match public key

I have tried using crt file. I have no idea what is wrong. I do not know what else to try. At the risk of my website not being down, I am desperate. What am I doing wrong?

Is in the ssl-bundle file a newline between the certs ?

After spending hours on this, I changed https://www.myhost.com to www.myhost.com:443 and it works. I also ended up just using the crt file.

The error is very confusing and I hope that gets fixed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.