In addition to Discourse’s built-in ACME solution, you can also manually configure an SSL certificate for Discourse using the following method:
Modify Configuration File
Navigate to the Discourse installation directory /var/discourse and edit the main containers/app.yml configuration file.
- Find the line
templates/web.letsencrypt.ssl.template.ymland add a # comment in front of it. - Find the line
templates/web.ssl.template.ymland remove the leading # (add this line manually if it is not present). - If the expose section below does not include
- "443:443", add it manually.
Save and exit the editor once finished.
Deploy SSL Certificate
Run mkdir -p /var/discourse/shared/standalone/ssl to create the certificate directory, then create the two files ssl.crt and ssl.key respectively, fill them with your certificate’s public and private keys, and save them.
Rebuild Discourse
Once the certificate deployment is complete, run ./launcher rebuild app in the /var/discourse directory to redeploy Discourse, and it will take effect once the deployment finishes.
