安装了 SSL 证书的 AWS EC2 上 Https 无法运行

安装了 SSL 证书的 AWS EC2 上 Https 无法运行

我已经在 AWS 上安装了 SSL,但无法在 https 上加载我的网站https://darkcloud.app(我的网站) 证书 负载均衡器 53 号公路

ubuntu@ip-172-31-8-134:~$ curl -v https://www.darkcloud.app
Rebuilt URL to: https://www.darkcloud.app/
  Trying 54.153.123.21...
Connected to www.darkcloud.app (54.153.123.21) port 443 (#0)
found 148 certificates in /etc/ssl/certs/ca-certificates.crt
found 594 certificates in /etc/ssl/certs
ALPN, offering http/1.1
gnutls_handshake() failed: An unexpected TLS packet was received.
Closing connection 0
curl: (35) gnutls_handshake() failed: An unexpected TLS packet was received.

答案1

似乎存在多个问题:

  1. 您正在使用访问该网站,darkcloud.app但它没有 DNS 条目,请创建与www.darkcloud.approute53 中类似的 DNS 条目
  2. 通过端口 443 即 https 访问站点会出现“未知协议”错误,表明负载均衡器未正确配置 https,请参阅下面的 curl 输出:

    $ curl -Ihttps://www.darkcloud.app curl:(35)错误:140770FC:SSL 例程:SSL23_GET_SERVER_HELLO:未知协议

通过 http(不是 https)访问端口 443 会出现 200,您能检查 ALB 的转发规则并查看协议是否是吗htttps

$ curl -I http://www.darkcloud.app
HTTP/1.0 200 OK
Date: Thu, 09 Aug 2018 17:58:22 GMT
Server: Apache/2.4.18 (Ubuntu)
Cache-Control: no-cache, private
Connection: close
Content-Type: text/html; charset=UTF-8

答案2

您已正确配置权威名称服务器以指向 AWS。但是,您尚未为您的域配置任何 A 记录。

查看文档:https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-creating.html

以下是我确定的方法:

查询 Google DNS 以查看该域配置了哪些 NS 记录:

 ttucker@dib:~$ dig ns darkcloud.app @8.8.8.8

 ; <<>> DiG 9.10.3-P4-Ubuntu <<>> ns darkcloud.app @8.8.8.8
 ;; global options: +cmd
 ;; Got answer:
 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11295
 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1

 ;; OPT PSEUDOSECTION:
 ; EDNS: version: 0, flags:; udp: 512
 ;; QUESTION SECTION:
 ;darkcloud.app.                    IN      NS

 ;; ANSWER SECTION:
 darkcloud.app.             21592   IN      NS      ns-1351.awsdns-40.org.
 darkcloud.app.             21592   IN      NS      ns-1770.awsdns-29.co.uk.
 darkcloud.app.             21592   IN      NS      ns-442.awsdns-55.com.
 darkcloud.app.             21592   IN      NS      ns-532.awsdns-02.net.

 ;; Query time: 7 msec
 ;; SERVER: 8.8.8.8#53(8.8.8.8)
 ;; WHEN: Thu Aug 09 17:50:50 UTC 2018
 ;; MSG SIZE  rcvd: 182

然后,当我查询每个 NS 服务器时,它们指示没有为您的域指定 A 记录:

第一的:

ttucker@dib:~$ dig darkcloud.app @ns-1351.awsdns-40.org

; <<>> DiG 9.10.3-P4-Ubuntu <<>> darkcloud.app @ns-1351.awsdns-40.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34844
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;darkcloud.app.                     IN      A

;; AUTHORITY SECTION:
darkcloud.app.              900     IN      SOA     ns-1351.awsdns-40.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

;; Query time: 6 msec
;; SERVER: 205.251.197.71#53(205.251.197.71)
;; WHEN: Thu Aug 09 17:52:37 UTC 2018
;; MSG SIZE  rcvd: 127

第二:

ttucker@dib:~$ dig darkcloud.app @ns-1770.awsdns-29.co.uk 

; <<>> DiG 9.10.3-P4-Ubuntu <<>> darkcloud.app @ns-1770.awsdns-29.co.uk
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38995
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;darkcloud.app.                     IN      A

;; AUTHORITY SECTION:
darkcloud.app.              900     IN      SOA     ns-1351.awsdns-40.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

;; Query time: 19 msec
;; SERVER: 205.251.198.234#53(205.251.198.234)
;; WHEN: Thu Aug 09 17:53:09 UTC 2018
;; MSG SIZE  rcvd: 127

第三:

ttucker@dib:~$ dig darkcloud.app @ns-442.awsdns-55.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> darkcloud.app @ns-442.awsdns-55.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17064
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;darkcloud.app.                     IN      A

;; AUTHORITY SECTION:
darkcloud.app.              900     IN      SOA     ns-1351.awsdns-40.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

;; Query time: 6 msec
;; SERVER: 205.251.193.186#53(205.251.193.186)
;; WHEN: Thu Aug 09 17:53:50 UTC 2018
;; MSG SIZE  rcvd: 127

第四:

ttucker@dib:~$ dig darkcloud.app @ns-532.awsdns-02.net

; <<>> DiG 9.10.3-P4-Ubuntu <<>> darkcloud.app @ns-532.awsdns-02.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49245
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;darkcloud.app.                     IN      A

;; AUTHORITY SECTION:
darkcloud.app.              900     IN      SOA     ns-1351.awsdns-40.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

;; Query time: 7 msec
;; SERVER: 205.251.194.20#53(205.251.194.20)
;; WHEN: Thu Aug 09 17:54:30 UTC 2018
;; MSG SIZE  rcvd: 127

相关内容