Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker 多域的certbot webroot只返回一个证书_Docker_Ssl_Certbot - Fatal编程技术网

Docker 多域的certbot webroot只返回一个证书

Docker 多域的certbot webroot只返回一个证书,docker,ssl,certbot,Docker,Ssl,Certbot,我正在尝试使用certbot certonly--webroot为多个域创建证书,但只获得了一个证书 好的,我看了这个教程:它对一个领域非常有效 因此,我尝试对两个域(sub.domain.com domain.com)执行相同的操作 nginx配置: server { listen 80; listen [::]:80; server_name domain.com www.domain.com; location / {

我正在尝试使用
certbot certonly--webroot
为多个域创建证书,但只获得了一个证书 好的,我看了这个教程:它对一个领域非常有效

因此,我尝试对两个域(sub.domain.com domain.com)执行相同的操作 nginx配置:

server {
        listen 80;
        listen [::]:80;

        server_name domain.com www.domain.com;

        location / {
                proxy_pass http://api:80;
        }

        location ~ /.well-known/acme-challenge {
                allow all;
                root /var/www/html;
        }
}

server {
            listen 80;
            listen [::]:80;

            server_name sub.domain.com www.sub.domain.com;

            location / {
                    proxy_pass http://api:80;
            }

            location ~ /.well-known/acme-challenge {
                    allow all;
                    root /var/www/html;
            }
    }
然后我在certbot容器中使用了以下命令:

command: certonly --force-renewal --webroot --webroot-path=/var/www/html -d domain.com -d sub.domain.com --email some.email@gmail.com --agree-tos --no-eff-email --staging
它的作品,但我只有一个证书(sub.domain.com)


如果在一个certbot命令中指定多个
-d
值,它将获得一个覆盖所有这些域的证书;参见第2段,您的案例参见第2段。如果您想要单独的证书,请使用单独的certbot命令。谢谢,但涵盖所有内容的“一个证书”是什么意思?我将对不同的域使用相同的证书?这意味着使用相同的ssl证书配置nginx域块ssl?是。或者您可以在http级别而不是服务器级别放置一次证书和密钥。如果你让certbot为你做配置,我相信它会做前者,但我目前没有一个设置,我可以很容易地确认。
certbot    | Saving debug log to /var/log/letsencrypt/letsencrypt.log
certbot    | Plugins selected: Authenticator webroot, Installer None
certbot    | Renewing an existing certificate
certbot    | IMPORTANT NOTES:
certbot    |  - Congratulations! Your certificate and chain have been saved at:
certbot    |    /etc/letsencrypt/live/sub.domain.com/fullchain.pem
certbot    |    Your key file has been saved at:
certbot    |    /etc/letsencrypt/live/sub.domain.com/privkey.pem
certbot    |    Your cert will expire on 2020-06-09. To obtain a new or tweaked
certbot    |    version of this certificate in the future, simply run certbot
certbot    |    again. To non-interactively renew *all* of your certificates, run
certbot    |    "certbot renew"
certbot exited with code 0