0

我正在努力解决以下问题。我在安装了 ubuntu 16.04 服务器的 digitalocean.com 服务中有一个 droplet。在这台服务器上,我安装了 Nginx HTTP 服务器。对于此服务器,我想连接 Google Domains 购买的域,这需要与服务器建立 SSL 连接。为了获得证书,我开始了本教程:https : //www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 我安装了 python-certbot -nginx 并开始配置 Nginx。当域认证开始时,会出现与 Google DNS 相关的错误:

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for placeholder.app
http-01 challenge for www.placeholder.app
Waiting for verification ...
Cleaning up challenges
Failed authorization procedure. www.placeholder.app (http-01): urn: ietf: params: acme: error: dns :: 
DNS problem: NXDOMAIN looking up A for www.placeholder.app

IMPORTANT NOTES:
- The following errors were reported by the server:

Domain: www.placeholder.app
Type: None
Detail: DNS problem: NXDOMAIN looking up A for
www.placeholder.app

这个问题有什么简单的解决方案吗?

4

1 回答 1

1

我建议在线下载 SSL 证书,然后像这样将其包含在 Nginx 配置文件中。

$ sudo nano /etc/nginx/conf.d/default.conf

编辑您的配置并让您的服务器使用 http2 监听端口 443。

listen       443 http2;
listen       [::]:443 http2;
server_name  localhost;

然后在它的正下方,添加 SSL 证书密钥的路径。

ssl        on;
ssl_certificate         /etc/certificate/public/certificate.pem;
ssl_certificate_key     /etc/certificate/private/certificate.key;

保存并退出。

现在把你的公钥放在这里:

$ sudo nano /etc/certificate/public/certificate.pem

你的私钥在这里:

$ sudo nano /etc/certificate/private/certificate.key

您现在已经安装了 SSL 证书。请重新启动您的 nginx 服务器以使更改生效。

$ sudo systemctl 重启 nginx.service

参考

于 2019-04-26T22:40:20.833 回答