Skip to content
Back

Help - Bug with Let's Encrypt certificate generation in Appwrite SSL

  • 1
  • Self Hosted
Ericooooo
11 Apr, 2025, 06:24

I'm facing an issue with SSL certificate generation in Appwrite (v1.6.1) on my VPS. Here's the error from the logs:

TypeScript
appwrite-worker-certificates | [Error] File: /usr/src/code/src/Appwrite/Certificates/LetsEncrypt.php
appwrite-worker-certificates | [Error] Line: 53
After investigation, I found the issue is in the LetsEncrypt.php file, at the line where the script tries to rename the certificate:
phpif (!@\rename('/etc/letsencrypt/live/' . $certName . '/cert.pem', APP_STORAGE_CERTIFICATES . '/' . $domain . '/cert.pem')) {
    throw new Exception('Failed to rename certificate cert.pem. Let\'s Encrypt log: ' . $stderr . ' ; ' . $stdout);
}```

I also noticed a second issue with subdomains configured as A records instead of CNAME:
``Cannot renew domain (www.example.mydomain.com) certificate: Failed to verify domain DNS records.``
Has anyone encountered a similar issue? Any ideas on how to fix this bug?
Thanks in advance for your help! 🙏
TL;DR
Issue with Let's Encrypt certificate generation in Appwrite SSL due to errors in LetsEncrypt.php file causing the domain certificate renewal to fail. The error is related to unexpected characters in the code. Additionally, subdomains configured as A records instead of CNAME are also causing DNS verification failures. Solution: You need to fix the syntax error in the LetsEncrypt.php file at line 53 where it tries to rename the certificate file. To address the issue with subdomains, ensure they are correctly configured as CNAME records instead of A records for successful DNS verification during certificate renewal.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more