User chagara encountered an SSL certificate error after enabling Let’s Encrypt on their self-hosted Discourse instance (hosted on DigitalOcean). The error indicated a PEM parsing issue with the certificate file. Community members robbyoconnor, Stephen, and pfaffman advised checking configuration in app.yml, ensuring correct templates are uncommented (including web.ssl.template.yml and web.letsencrypt.ssl.template.yml), exposing port 443, and confirming DNS A records point to the droplet’s IP. chagara confirmed their config matched recommendations but still faced the error. After trying multiple rebuilds and deleting SSL directories, chagara resolved the issue by running ./discourse-setup, realizing their mistake was using DigitalOcean’s one-click deploy scripts instead of the standard discourse-setup tool. The fix highlights the importance of using Discourse’s official setup tool for Let’s Encrypt configuration, even when starting from a managed deployment. Stephen had earlier suggested running discourse-setup as a diagnostic step, which ultimately proved successful. No reverse proxy (like Cloudflare) was involved, and DNS was correctly configured. The thread concludes with chagara thanking the community for the help.
I’m hosting discourse in digital ocean and added all the DNS records. The site is in https://forum.jlozadad.io. After adding the required changes to use letsencrypt and rebuild I get this error after the site completes rebuilding
If you’re using the standard install the letsencrypt and web.ssl templates need to be uncommented in your app.yml and you need to put your email address into the let’s encrypt email field.
yes that’s what I have in the configuration and it seems that it creates the certificates and everything but, when looking at the nginx error.log the error pasted above comes up.
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
- "templates/web.ssl.template.yml"
- "templates/web.letsencrypt.ssl.template.yml"
expose:
- "80:80" # http
- "443:443" # https
LETSENCRYPT_ACCOUNT_EMAIL: 'myemail@gmail.com'
ok, I’ll try discourse-setup but, yes I removed the lets encrypt and ssl directories a couple of times, rebuild and still ran into the error listed in the first post.
ok so using discourse-setup fixed it complete. I think the mistake was that I’m using Digital Ocean’s option to one click deploy discourse and used their scrips located in /var/lib/digitalocean to rebuild it. Also used the ./launcher rebuild app after making the changes and need to use discourse-setup. Thank you for all the help
!