Forcing Discourse through SSL in Bitnami Stack


(Cee Kay) #1

I am starting a forum. And for that I bought a VPS, which is a LXC container. Since, Install a container(Docker) Inside a docker isn’t viable I had to choose Bitnami Stack for Discourse. Bitnami’s installer is simple to use. But, there are a lot of limitations. One such limitation is the incomplete or errorneous documentation.

To Force SSL, in their documentation for discourse they have told us to add some lines of code to /apache2/conf/httpd-vhosts.conf. But, when you search for that file, you will be surprised to see it in the /apache2/conf/extra/httpd-vhosts.conf. Even after I added the lines of code they have suggested, It didn’t work. So I had to follow the below steps.

  1. Add the below code on the <VirtualHost *:80> block:
RewriteEngine On 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

After adding the above Rule snippet. You have configure whatever information there exists, with the one matching your installation settings.

  1. Open /apache/conf/httpd.conf and then scroll down to find the below snippet and uncomment the line starting with Include.
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
  1. Restart the stack by moving back to the /discourse-1.5.3-1/ folder and restart the apache server using

./ restart apache

After completing the steps, your discourse will automatically redirect from http to https

(Rafael dos Santos Silva) #2

I just need to say that are several security problems in Discourse 1.5.3, and an upgrade is recommended ASAP.

(Cee Kay) #3

Will do it as soon possible. Thank you Falco