I use jwilder/nginx-proxy with discourse just fine.
What I did was to add the following stuff to my app.yml file:
VIRTUAL_HOST: domain.com
VIRTUAL_PORT: 80
LETSENCRYPT_HOST: domain.com
LETSENCRYPT_EMAIL: some@email.com
My ports are like this, but I don’t remember anymore why… I think it avoid discourse complaining about host 80 port is being used :
expose:
- "127.0.0.1:3040:80"`
Make sure your container is connected to the nginx network with:
docker_args:
- "--network=name-of-your-network"
To fix discourse not getting the real IP from the host nginx, add this to your app.yml
:
run:
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: "types {"
to: |
set_real_ip_from 172.18.0.0/24;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
types {
Make sure the network there matches the subnet of your nginx docker network. You can check with docker inspect nginx-proxy
and the ip in the command above will always be your gateway but replace last digit for 0.
So for me my nginx-proxy gateway is 172.18.0.1
so that’s why I have it as 172.18.0.0