# 与 Traefik 2.0 的讨论

**URL:** https://meta.discourse.org/t/discourse-with-traefik-2-0/130357
**Category:** Self-hosting
**Created:** [2019年十月6日 18:57 UTC](https://meta.discourse.org/t/discourse-with-traefik-2-0/130357 "2019-10-06T18:57:04Z")
**Posts on this page:** 1
**Showing post:** 16

<div class="post-metadata">

### Author: ![PackElend](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/packelend/32/95294_2.png) [@PackElend](https://meta.discourse.org/u/PackElend)
#### Post date: [2020年一月7日 08:09 UTC](https://meta.discourse.org/t/discourse-with-traefik-2-0/130357/16 "2020-01-07T08:09:17Z")

</div>

> [@Cerix](#):
>
> 对于 SSL，只需配置 Traefik + Let’s Encrypt，无需使用 discourse ssl。

是的，参见 [https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247，但看起来当客户端通过](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247%EF%BC%8C%E4%BD%86%E7%9C%8B%E8%B5%B7%E6%9D%A5%E5%BD%93%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%80%9A%E8%BF%87) https 与代理通信时，discourse 期望某些标头信息。

> [@riking](#):
>
> ```plaintext
> server {
> listen 80; listen [::]:80;
> server_name forum.example.com; # <-- 修改此处
> 
> 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;
> }
> }
> 
> ```

我简要阅读了相关内容。我会尝试将其翻译成普通上班族也能理解的文字。

> [@Cerix](#):
>
> Traefik 将管理所有容器的加密

是的，另见 [https://docs.traefik.io/https/overview。起初我直接启用了](https://docs.traefik.io/https/overview%E3%80%82%E8%B5%B7%E5%88%9D%E6%88%91%E7%9B%B4%E6%8E%A5%E5%90%AF%E7%94%A8%E4%BA%86) https，证书创建也成功了，但仅此而已。现在我需要将其与我此后获得的知识进行对齐。

> [@Cerix](#):
>
> 目前，我使用的是 traefik 1.6，所以我还不知道如何在 traefik v2 上启用它

所以你是通过 https 访问你的论坛，对吧？  
你能分享一下 Traefik 和 Discourse 的配置吗？分享得越多，我周末处理起来就越容易。  
v1 到 v2 的迁移指南见 [https://docs.traefik.io/migration/v1-to-v2/，但我会在本周末尝试在这里进行解释。](https://docs.traefik.io/migration/v1-to-v2/%EF%BC%8C%E4%BD%86%E6%88%91%E4%BC%9A%E5%9C%A8%E6%9C%AC%E5%91%A8%E6%9C%AB%E5%B0%9D%E8%AF%95%E5%9C%A8%E8%BF%99%E9%87%8C%E8%BF%9B%E8%A1%8C%E8%A7%A3%E9%87%8A%E3%80%82)

---

_[View the full topic](https://meta.discourse.org/t/discourse-with-traefik-2-0/130357)._
