discourse邮箱配置以及使用Nginx反向代理共存

outlook:

DISCOURSE_SMTP_ADDRESS: smtp.office365.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: [email protected]
DISCOURSE_SMTP_PASSWORD: **********
DISCOURSE_SMTP_ENABLE_START_TLS: true
DISCOURSE_SMTP_AUTHENTICATION: login

gmail: gmail需要设置为允许不安全连接,在个人账户里面设置,设置地址:https://myaccount.google.com/security gmail和google suite均可以正常使用

DISCOURSE_SMTP_ADDRESS: smtp.gmail.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: [email protected]
DISCOURSE_SMTP_PASSWORD: "xxx"
DISCOURSE_SMTP_ENABLE_START_TLS: true

让nginx在前端,反代discourse,达到nginx和discourse共存的目的:

首先停止nginx,把discourse安装好。然后停止discrorse,

先停止discrorse,

./launcher stop app

修改app.xml

注释掉下面内容:

# expose:
# - "80:80"   # http
# - "443:443" # https

下面两行也注释掉:

# - "templates/web.ssl.template.yml"
# - "templates/web.letsencrypt.ssl.template.yml"

添加下面一行:

- "templates/web.socketed.template.yml"
注意到对齐

接着修改域名对应的nginx配置文件:

server {
    ssl_certificate      /var/discourse/shared/standalone/ssl/ssl.crt;
    ssl_certificate_key  /var/discourse/shared/standalone/ssl/ssl.key;
    #修改为自己域名对应的证书,安装discourse时自动生成的证书
    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 https;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

最后执行service nginx restart./launcher rebuild app