gpt4 book ai didi

SSL Let's Encrypt 安装在 AWS EC2 的 NGINX 上不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 14:00:19 26 4
gpt4 key购买 nike

我有一个安装了 NGINX 并且可以正常工作的 AWS EC2 实例,但是使用 Let's Encrypt 的 SSL 无法访问。

Nginx 配置

Nginx Configuration

文件夹/etc/pki/tls 包含 Let's Encrypt corretly 生成的文件

enter image description here

此 EC2 实例的 AWS 安全组

enter image description here

不涉及负载均衡器 (ELB),Route 53 将流量直接发送到此 EC2 实例。

当我尝试通过 HTTP 访问网站时,一切正常,但是当我尝试通过 HTTPS 连接时,这是不可能的

enter image description here enter image description here

非常感谢

最佳答案

根据 https://nginx.org/en/docs/http/ngx_http_core_module.html#listen您在 listen 配置指令中缺少 ssl 关键字。

The ssl parameter (0.7.14) allows specifying that all connections accepted on this port should work in SSL mode. This allows for a more compact configuration for the server that handles both HTTP and HTTPS requests.

另请参阅从 https://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server 开始的示例,例如:

It is possible to configure a single server that handles both HTTP and HTTPS requests:

server {
listen 80;
listen 443 ssl;
server_name www.example.com;
ssl_certificate www.example.com.crt;
ssl_certificate_key www.example.com.key;
...
}

同样为了调试,您可以首先使用任何 http 客户端(例如 wgetcurl 从服务器本身(到它自己)进行本地连接打开 s_client。当 HTTPS 成功运行时,您可以远程尝试。

关于SSL Let's Encrypt 安装在 AWS EC2 的 NGINX 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53344575/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com