Add SSL Certificates to Discourse
After having deployed discourse, you may wish to configure it to use SSL so that people can log in securely.
You need to place the certificate file at:
... and your key file needs to be:
These files are inside a volume used by the container, which is why the names and paths are important to get exactly right.
Go to your app.yml file and uncomment the line:
... so it should look like:
... 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" ...
Since the discourse server uses nginx, your
ssl.crt file needs to contain your site certificate any any intermediary certificate files and in the correct order. For example, if you have
my-site.crt and a certificate authority file of
ca.crt, then you would need to do the following to create your certificate file:
cat my-site.crt > ssl.crt echo "" >> ssl.crt cat ca.crt >> ssl.crt
Finally, we need need to get nginx to reload to use these certificates. Enter the container and run:
Read the output to check that nginx is happy with the configuration, if not then you need to check your certificates. Once you have confirmed nginx is happy with your configuration, reload it with:
sudo nginx -s reloadâ€‹
First published: 16th August 2018