# 如何使用 Cloudflare 保护 Discourse 站点

**URL:** <https://meta.discourse.org/t/how-to-use-cloudflare-to-protect-a-discourse-site/279713>\
**Category:** Self-hosting\
**Created:** [2023 年9 月 21 日 18:00 UTC](https://meta.discourse.org/t/how-to-use-cloudflare-to-protect-a-discourse-site/279713 "2023-09-21T18:00:16Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Lee\_Kris](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee_kris/32/327398_2.png) [@Lee\_Kris](https://meta.discourse.org/u/Lee_Kris)\
**Post date:** [2023 年9 月 21 日 21:28 UTC](https://meta.discourse.org/t/how-to-use-cloudflare-to-protect-a-discourse-site/279713/3 "2023-09-21T21:28:17Z")

</div>

您好 Simon：

是的，我有一个自托管网站，我注意到可以将其添加到 app.yml 然后重建

- “templates/cloudflare.template.yml”

我是否需要将以下 templates.yml 也添加到 app.yml，还是保持禁用状态？

- “templates/web.ssl.template.yml”
- “templates/web.letsencrypt.ssl.template.yml”

另外，如果我使用像 Nginx 这样的代理并受到 CF 的保护，我是否可以更改默认的暴露端口，如下所示，然后通过手动写入 nginx 配置文件来附加来自 CF 的 SSL 证书？  
expose:  
- “81:80”

# - “443:443”

---

_[View the full topic](https://meta.discourse.org/t/how-to-use-cloudflare-to-protect-a-discourse-site/279713)._
