【问题标题】:certbot-auto / letsencrypt setting up one key for multiple domains pointing to the same servercertbot-auto /letsencrypt 为指向同一服务器的多个域设置一个密钥
【发布时间】:2017-04-06 20:11:52
【问题描述】:

我真的更像是一个前端开发人员,所以服务器配置的东西对我来说是一个非常新的领域,对不起,如果这是一个简单的问题!

我在尝试让我的 certbot-auto 为多个域生成一个指向一个框的 SSH 密钥时遇到了一些麻烦。

我有 3-4 个域(domain1.netdomain2.iodomain3.medomain4.codes),它们都指向同一个 Digital Ocean 水滴。

以前(几个月前),我曾直接用letsencrypt 尝试过这个(当时没有certbot)。不知何故,我的所有域都使用了 SSL,但它们最近过期了,我现在似乎只能续订 domain1.net 而不能续订其他域。

我尝试了以下命令:

./certbot-auto certonly -a webroot --agree-tos -w /var/www/domain1.net/public_html/ \--expand -d domain1.net,www.domain1.net,domain2.io,www.domain2.io,domain3.me,www.domain3.me,domain4.codes,www.domain4.codes

...似乎可行,我得到了以下信息:

| Saving debug log to /var/log/letsencrypt/letsencrypt.log             │
│ Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org      │
│ Cert not yet due for renewal                                         │
│ Renewing an existing certificate                                     │
│ Performing the following challenges:                                 │
│ http-01 challenge for domain1.net                                    │
│ http-01 challenge for www.domain1.net                                │
│ http-01 challenge for domain2.io                                     │
│ http-01 challenge for www.domain2.io                                 │
│ http-01 challenge for domain3.me                                     │
│ http-01 challenge for www.domain3.me                                 │
│ http-01 challenge for domain4.codes                                  │
│ http-01 challenge for www.domain4.codes                              │
│ Using the webroot path /var/www/domain1.net/public_html for          │
│ all unmatched domains.                                               │
│ Waiting for verification...                                          │
│ Cleaning up challenges                                               │
│ Generating key (2048 bits):                                          │
│ /etc/letsencrypt/keys/0012_key-certbot.pem                           │
│ Creating CSR: /etc/letsencrypt/csr/0012_csr-certbot.pem

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at
   /etc/letsencrypt/live/domain1.net/fullchain.pem. Your cert
   will expire on 2017-02-20. To obtain a new or tweaked version of
   this certificate in the future, simply run certbot-auto again. To
   non-interactively renew *all* of your certificates, run
   "certbot-auto renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

.. 好的,太好了!然而,只有domain1.netwww.domain1.net 似乎在工作......其他域声称没有使用HTTPS!

我还在/etc/letsencrypt/live/ 目录中看到了多个文件。我之前曾试图让这个工作(直接使用letsencrypt,而不是通过certbot)并且一直工作到今天,当它们过期并拒绝续订时。这是我在该目录中看到的:

tom@Personal:/opt$ sudo ls -la /etc/letsencrypt/live/
total 20
drwx------ 5 root root 4096 Nov 22 18:22 .
drwxr-xr-x 8 root root 4096 Nov 22 18:22 ..
drwxr-xr-x 2 root root 4096 Nov 22 18:41 domain1.net
drwxr-xr-x 2 root root 4096 Oct 16 00:00 domain1.net-0001
drwxr-xr-x 2 root root 4096 Nov 22 18:22 www.domain1.net

嗯..不知道为什么那里有多个条目。不应该只有一个吗?

无论如何——我对 HTTPS / 密钥 / NginX 不够精通,无法弄清楚这一点,我正在抓狂。我只想获取我的 SSL 密钥:

  1. 为上述所有域工作
  2. 通过 certbot-auto renew 自动更新

并不确定我在哪里搞砸了......非常感谢任何帮助!

编辑:这是我的服务器配置块在 nginx 中的样子:

server {
# listen 80 default_server;
# listen [::]:80 default_server ipv6only=on;


  # START LETS ENCRYPT ADDITIONS:
  listen 443 ssl;
  server_name domain1.net www.domain1.net domain2.io www.domain2.io domain3.me www.domain3.me domain4.codes www.domain4.codes;
  ssl_certificate /etc/letsencrypt/live/www.domain1.net/fullchain.pem; # managed by Certbot
  ssl_certificate_key /etc/letsencrypt/live/www.domain1.net/privkey.pem; # managed by Certbot
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;
  ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  # /END LETS ENCRYPT ADDITION

  root /var/www/domain1.net/public_html;
  index index.php index.html index.htm;

  # FOR LETSENCRYPT AUTO-RENEWAL, we must give it access to /.well-known
  location ~ /.well-known {
    allow all;
  }
  # /END LETSENCRYPT AUTO_RENEWAL

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
  }

【问题讨论】:

    标签: nginx https lets-encrypt certbot


    【解决方案1】:

    只是想跟进 - 我得到了这个工作!

    原来我的命令是正确的,但我误用了-dflag——它需要分别应用于每个域。所以更正的命令:

    ./certbot-auto certonly -a webroot --agree-tos -w /var/www/domain1.net/public_html/ \--expand -d domain1.net,www.domain1.net  -d domain2.io,www.domain2.io -d domain3.me,www.domain3.me -d domain4.codes,www.domain4.codes
    

    【讨论】:

    • 太棒了!但是,如果您有超过 100 个域怎么办?您仍然可以通过 1 个带有 Let encrypt 的证书来做到这一点吗?如果您不知道答案,我理解。
    猜你喜欢
    • 2011-11-22
    • 2017-02-21
    • 2014-10-04
    • 2012-10-19
    • 2019-08-18
    • 1970-01-01
    • 2013-12-12
    • 2020-02-12
    • 2015-12-03
    相关资源
    最近更新 更多