# 升级后运行多个容器时出现防火墙问题

**URL:** https://meta.discourse.org/t/firewall-issue-with-running-multiple-containers-after-upgrade/178507
**Category:** Self-hosting
**Created:** [2021年一月31日 22:03 UTC](https://meta.discourse.org/t/firewall-issue-with-running-multiple-containers-after-upgrade/178507 "2021-01-31T22:03:52Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![AstonJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/astonj/32/215041_2.png) [@AstonJ](https://meta.discourse.org/u/AstonJ)
#### Post date: [2021年二月2日 01:16 UTC](https://meta.discourse.org/t/firewall-issue-with-running-multiple-containers-after-upgrade/178507/11 "2021-02-02T01:16:33Z")

</div>

> [@fitzy](#):
>
> 你是在容器内部运行 nginx 吗？接下来我想尝试追踪请求最终到达了哪里。据我理解，你使用 HAProxy 进行 SSL 终止，然后将请求代理到相应的容器中，对吗？

据我所知，容器本身都是“标准”配置（所以我推测每个容器都在运行 nginx），是的，HAProxy 处理所有 SSL 并将请求分发到各个容器。

我的设置完全按照这里的指南：[https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013（其中](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013%EF%BC%88%E5%85%B6%E4%B8%AD) SSL 版本的 HAProxy 配置见[此处](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013/18)）。

HAProxy 配置曾出现过一个问题：

```plaintext
backend main_apache_sites
  server server1 127.0.0.1:8080 cookie A check
  cookie JSESSIONID prefix nocache

backend discourse_docker
  server server2 127.0.0.1:8888 cookie A check
  cookie JSESSIONID prefix nocache

backend discourse_docker_2
  server server2 127.0.0.1:8889 cookie A check
  cookie JSESSIONID prefix nocache

backend discourse_docker_3
  server server2 127.0.0.1:8890 cookie A check
  cookie JSESSIONID prefix nocache

backend letsencrypt-backend
  server letsencrypt 127.0.0.1:54321

```

不知为何，所有 Discourse 后端在第二行都配置为 `server2`。我昨天将它们分别改为了 `server2`、`server3` 等，但这并没有带来任何改变（而且之前这样配置时一切正常）。

有没有特定的日志文件可以查看，以提供更多线索？也许是 Docker 日志文件？

> [@pfaffman](#):
>
> 所有 `yml` 容器是否都已注释掉（或移除）了 SSL 和 Lets Encrypt 模板？

是的，这些都已注释掉：

```plaintext
templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## 如果希望添加 Lets Encrypt (https)，请取消以下两行的注释
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

```

---

_[View the full topic](https://meta.discourse.org/t/firewall-issue-with-running-multiple-containers-after-upgrade/178507)._
