# 使用 app.yml 配置 cerbot？

**URL:** <https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994>\
**Category:** Self-hosting\
**Created:** [2022年一月6日 00:15 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994 "2022-01-06T00:15:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)\
**Post date:** [2022年一月6日 00:15 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994/1 "2022-01-06T00:15:57Z")

</div>

您好，

我的网站正在使用 Cloudflare，一切都很好，但我在检查 HTTPS 时看到：

**https 443：错误：SSPI 调用失败，请参阅内部异常。**

我想禁用 Cloudflare SSL，而是使用 certbot，但我需要像下面这样安装 certbot 模块（使用 Cloudflare）：

```plaintext
certbot certonly \
  --dns-cloudflare \
  --dns-cloudflare-credentials ~/.secrets/certbot/cloudflare.ini \
  -d example.com \
  -d www.example.com

```

> **[Welcome to certbot-dns-cloudflare’s documentation! — certbot-dns-cloudflare 0...](https://certbot-dns-cloudflare.readthedocs.io/en/stable/)**

我可以在 discourse 的模板文件或 app.yml 文件中放置这些 certbot 命令吗？

另外，应该有一个用于 Cloudflare 访问的文件，并且需要将其权限设置为 chmod 600。

`~/.secrets/certbot/cloudflare.ini`

请建议我们如何实现这一点。

谢谢！

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2022年一月6日 06:44 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994/2 "2022-01-06T06:44:00Z")

</div>

您是如何安装 Discourse 的？如果您执行标准安装，默认情况下您将获得 Let’s Encrypt 的证书。但是，它无法与前面的 Cloudflare 一起使用。

您或许可以查看 Let’s Encrypt 模板并对其进行修改，以实现您所建议的功能。

---

<div class="post-metadata">

**Author:** ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)\
**Post date:** [2022年一月6日 10:34 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994/3 "2022-01-06T10:34:57Z")

</div>

嗨 Jay，

没错，我正在处理这个问题，但不幸的是，我在编程或 bash 脚本方面经验不多，无法解决这个问题……但我没有找到任何带有 Let’s Encrypt 的 certbot 模块可以做到这一点……也许我们可以将我们的代码添加到这一行：

```plaintext
          # 如果出现问题，请重试颁发证书
          issue_cert "4096" "--force"
        fi

        LE_WORKING_DIR="${LETSENCRYPT_DIR}" $$ENV_LETSENCRYPT_DIR/acme.sh \
          --installcert \
          -d $$ENV_DISCOURSE_HOSTNAME \
          --fullchainpath /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.cer \
          --keypath /shared/ssl/$$ENV_DISCOURSE_HOSTNAME.key \
          --reloadcmd "sv reload nginx"

```

使用

```plaintext

certbot certonly \
  --dns-cloudflare \
  --dns-cloudflare-credentials ~/.secrets/certbot/cloudflare.ini \
  -d example.com \
  -d www.example.com

```

我希望有编程经验的人能帮助我们将此代码与 Let’s Encrypt 证书集成？

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2022年一月6日 16:05 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994/4 "2022-01-06T16:05:37Z")

</div>

Discourse 没有理由使用 certbot。标准的安装指南将自动配置 Let’s Encrypt 证书。

---

<div class="post-metadata">

**Author:** ![f1r4s](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/f1r4s/32/245347_2.png) [@f1r4s](https://meta.discourse.org/u/f1r4s)\
**Post date:** [2022年一月6日 16:09 UTC](https://meta.discourse.org/t/configure-cerbot-with-app-yml/213994/5 "2022-01-06T16:09:36Z")

</div>

原因是使 Let’s Encrypt SSL 与 CloudFlare 兼容。

> **[Welcome to certbot-dns-cloudflare’s documentation! — certbot-dns-cloudflare 0...](https://certbot-dns-cloudflare.readthedocs.io/en/stable/)**
