【问题标题】:Certbot Fails Domain AuthenticationCertbot 域身份验证失败
【发布时间】:2019-10-17 05:56:25
【问题描述】:

我被难住了。我有 2 个不同的域,我正在尝试在 Digital Ocean Ubuntu 服务器上使用 Certbot 安装 SSL 证书。这是我为获取 SSL 证书而运行的最终命令:

sudo certbot --nginx -d mydomain1.com -d www.mydomain1.com

我对@9​​87654322@ 和mydomain2.com 运行完全相同的命令

这是没有意义的。 mydomain1.com 的身份验证通过,但 mydomain2.com 的身份验证失败

我对两个域都使用相同的 Nginx 服务器块配置文件。是的,这包括根文件路径和在 Nginx 配置文件中相同的服务器名称。

我将两个配置文件都设置为以下:

listen 80;
listen [::]:80;

root /var/www/mydomain2.com;

index index.html index.htm index.nginx-debian.html;

server_name mydomain2.com www.mydomain2.com;

是的,两个配置文件(mydomain1.commydomain2.com 都设置为 mydomain2.com 的根路径和 mydomain2.com 的服务器名称,因为我需要 Nginx 提供与该目录中完全相同的内容.我的意图是让mydomain1.com重定向到mydomain2.com但它似乎不像那是一个单独的问题。现在我只是想验证mydomain2.com的SSL证书然后我'将找出重定向。

提前感谢您的帮助。

【问题讨论】:

    标签: ssl nginx digital-ocean ubuntu-18.04 certbot


    【解决方案1】:

    如果我理解正确的话,答案如下:

    certbot certonly --standalone --preferred-challenges http -d domain1.com -d www.domain1.com
    

    你不需要修改 nginx default.conf 文件。请改用以下方法。

    纳米/etc/nginx/sites_available/domain1.com

    server {
            listen 80;
            listen [::]:80;
            server_name domain1.com www.domain1.com;
            return 301 https://domain1.com\$request_uri;
    }
    server {
            listen 443 ssl;
            server_name domain1.com;
            ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem;
    }
    

    站点启用符号链接

    ln -s /etc/nginx/sites-available/domain1.conf /etc/nginx/sites-enabled
    

    在 domain2.com 中也一样

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-10
      • 2014-01-24
      • 2021-11-18
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多