Enable SSL in Discourse

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.

First, configure Apache to enable SSL connections. Then, force HTTPS for all Discourse links using one of the following options:

  • Enable the following option in the Discourse site_settings.yml configuration file.

    NOTE: Depending on your installation type, the Discourse site_settings.yml configuration file can be found in the following locations:

    • Approach A (Bitnami installations using system packages): installdir/discourse/config/site_settings.yml

    • Approach B (Self-contained Bitnami installations): installdir/apps/discourse/htdocs/config/site_settings.yml

          default: true

    NOTE: In older Discourse versions, the option name is use_ssl or use_https.

  • If the HTTPS port is not the standard port 443, update the HTTPS port entry in the database by following the steps below:

    • Log in to the server console.

    • Start the PostgreSQL command-line client and connect to the PostgreSQL database.

    • Execute the following SQL command, replacing the NEW_PORT placeholder with the number of the SSL port.

        bitnami_discourse=# UPDATE site_settings SET value = 'NEW_PORT' WHERE name = 'port'
  • Disable HTTP and redirect all requests to HTTPS URLs.

  • Restart the server:

      $ sudo installdir/ restart
Last modification June 16, 2021