SSL让我们加密安装在AWS EC2的NGINX上不起作用

时间:2018-11-16 19:58:29

标签: ssl nginx amazon-ec2 lets-encrypt

我有一个已安装并正在运行NGINX的AWS EC2实例,但是带有Let's Encrypt的SSL无法访问。

Nginx配置

Nginx Configuration

包含/ etc / pki / tls的文件夹,其中包含我们正确加密的文件

enter image description here

此EC2实例的AWS安全组

enter image description here

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

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

enter image description here enter image description here

非常感谢

1 个答案:

答案 0 :(得分:1)

对于每个https://nginx.org/en/docs/http/ngx_http_core_module.html#listen,您缺少ssl配置指令中的listen关键字。

  

ssl参数(0.7.14)允许指定此端口上接受的所有连接均应在SSL模式下工作。这样可以为处理HTTP和HTTPS请求的服务器提供更紧凑的配置。

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

  

可以配置处理两个HTTP的单个服务器   和HTTPS请求:

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

要调试,也可以先使用任何wgetcurlopenssl s_client之类的http客户端从服务器本身(到其自身)进行本地连接。如果该协议成功适用于HTTPS,则可以远程尝试。

相关问题