# 使用 Let's Encrypt 设置多个域名 / 重定向

**URL:** https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685
**Category:** Sysadmins
**Tags:** how-to, letsencrypt
**Created:** [2017年二月1日 02:21 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685 "2017-02-01T02:21:03Z")
**Posts on this page:** 1
**Showing post:** 136

<div class="post-metadata">

### Author: ![45thj5ej](https://avatars.discourse-cdn.com/v4/letter/4/34f0e0/32.png) [@45thj5ej](https://meta.discourse.org/u/45thj5ej)
#### Post date: [2024年四月2日 18:09 UTC](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685/136 "2024-04-02T18:09:57Z")

</div>

**编辑：已找到修复方法，忽略下方所有内容，但为方便以后的人保留。修复方法放在最底部。**

刚偶然看到这个帖子。所以，我的网站是：`forums.mysite.me`。我的 NGINX 配置中有 3 个域名，并且我的域名提供商正在使用 DNS CNAME 来提供这些域名，但它们显示不安全：

```plaintext
mysite.me
www.mysite.me
forum.mysite.me (如果没有“s”，如果有人拼错或猜测 URL)

```

我应该在原始帖子中的配置中使用我的基础域名吗？或者如何为所有 3 个域名进行设置？

```plaintext
after_ssl:
   # 告诉 letsencrypt 获取哪些附加证书
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d forums.mysite.me --keylength"
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--fullchainpath/
        to: "-d forums.mysite.me --fullchainpath"

```

我很困惑，因为第一个“replace”部分有一个 `from: /--keylength/`，而它下面的部分有一个 `from: /--fullchainpath/`。那么，我是否需要为我列出的这 3 个 URL 中的每一个都创建 2 个条目？或者……会是这样吗？

```plaintext
after_ssl:
   # 告诉 letsencrypt 获取哪些附加证书
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--keylength/
        to: "-d mysite.me -d www.mysite.me -d forum.mysite.me --keylength"
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /--fullchainpath/
        to: "-d mysite.me -d www.mysite.me -d forum.mysite.me --fullchainpath"

```

^ 是的，上面的框就是处理多个站点/LetsEncrypt 的修复方法。太激动了。

---

_[View the full topic](https://meta.discourse.org/t/set-up-let-s-encrypt-with-multiple-domains-redirects/56685)._
