all that has to be done is to use TLS. If you play with whoami it shows you that Treafik add the required inforamtion as specificed in Run other websites on the same machine as Discourse - #302 - sysadmin - Discourse Meta by itself, no action needed.
server {
listen 80; listen [::]:80;
server_name forum.example.com; # <-- change this
location / {
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
my config
discourse app.yml extract
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"
## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
#- "80:80" # http
#- "443:443" # https
#- "80" # http
#- "443" # https
#- "40080:80"
#- "40443:443"
labels:
app_name: discourse
#----Traefik lables------------------------
traefik.enable: true
traefik.docker.network: bridge_proxy_traefikv2
#---HTTP ROUTER SECTION-------------------
traefik.http.routers.discourse.rule: Host(`forum.fairbnb.community`)
#--HTTP SECTION--------------------------
traefik.http.routers.discourse.entrypoints: web
traefik.http.routers.discourse.middlewares: discourse_redirect2https
#traefik.http.services.discourse.loadbalancer.server.port: 80
#---HTTPS ROUTER SECTION
traefik.http.routers.discourse_secure.rule: Host(`forum.fairbnb.community`)
#--HTTPS SECTION
traefik.http.routers.discourse_secure.entrypoints: websecure
traefik.http.services.discourse_secure.loadbalancer.server.port: 80
#--TLS SECTION
traefik.http.routers.discourse_secure.tls.certresolver: tlsChallenge_letsencrypt
#---MIDDLEWARE SECTION redirect http to https
traefik.http.middlewares.discourse_redirect2https.redirectscheme.scheme: https
docker_args:
- "--network=bridge_proxy_traefikv2"
params:
Treafik Static Config
global:
checkNewVersion: true
entryPoints:
web:
address: :80
websecure:
address: :443
api:
debug: true
providers:
docker:
exposedByDefault: false
network: bridge_proxy_traefikv2
log:
level: DEBUG
filePath: /var/log/traefik-log.log
accessLog:
filePath: /var/log/traefik-access.log
certificatesResolvers:
tlsChallenge_letsencrypt:
acme:
email: my.secret@gmail.com
storage: /etc/ssl/certs/letsencrypt/acme.json
tlsChallenge: {}