Install Discourse with Docker in a Subfolder with SSL and serve other content with nginx under the same domain

Discourse is a great free and open-source forum software.
There is an Linux installation guide with docker, but Discourse runs with a subdomain like I want Discourse run in a subfolder like

There is a guide how to do this, but how to configure the nginx server to serve other content ( or on the same machine?

  1. install discourse with docker on a linux server

  2. change the port of the docker container and setup SSL with Let’s Encrypt (don’t use the subdomain like use

  3. create a folder for all the other content for your site

sudo mkdir -p /var/www/

if necessary change the owner to you or www-data

sudo chown -R www-data:www-data /var/www/

This is the root folder for your domain
Dont create a forum folder here, it will cause a conflict with the discourse docker redirect!

  1. change the /etc/nginx/sites-enabled/discourse to this and replace with your url (use main url not subdomain)

server {
        listen 80;
        return 301$request_uri;
server {
        listen 443 ssl spdy;
        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AE$
        ssl_prefer_server_ciphers on;

        location / {
                root /var/www/;

        location /forum/ {
                proxy_read_timeout      90;
  1. restart nginx
sudo service nginx restart

If you go to your Discourse site should appear and if you go to you should see your index.html (if you created one).

Leave your vote

14 points
Upvote Downvote

Total votes: 7

Upvotes: 7

Upvotes percentage: 100.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.