【问题标题】:How to configure amazon issued free certificate to nginx.config如何配置亚马逊颁发的免费证书到 nginx.config
【发布时间】:2020-11-23 02:45:39
【问题描述】:

我已经在Amazon Linux 2 环境中安装了nginx 服务器。在创建 Elastic Load Balancer 期间,我创建了 Amazon 的免费证书。现在,我想通过https(端口443)访问我的服务器。如何在nginx.conf 中配置此SSL 证书?

nginx.conf 中的 SSL 配置现在被注释掉了。我看到它包含两行,例如:

 #        ssl_certificate "/etc/pki/nginx/server.crt";
 #        ssl_certificate_key "/etc/pki/nginx/private/server.key";

现在,亚马逊证书和密钥文件的位置在哪里?

【问题讨论】:

    标签: amazon-web-services nginx ssl


    【解决方案1】:

    你不能这样做。 ACM 证书只能用于负载均衡器 (LB)、CloudFront 分配和 API 网关。它们不能在实例上使用。

    这样你在 LB 上终止你的 https,然后从 LB 那里只有 http 连接到你的实例:

    Client ----(https)---> LB ----(http)----> Instance(s)
    

    如果您想在 LB 和您的实例之间使用 https,那么您必须为此使用自签名证书,但这并不常用。通常在 LB 上终止 https 就足够了。

    【讨论】:

    • 当我访问 LB DNS 时,我的 laravel 应用程序的 url('/') 助手会生成 http 但不会生成 https。
    • @Rejaul 你在 LB 上设置了从 80 端口到 443 的重定向,这样你就可以一直服务器 https 了吗?
    • 不可以,但我可以访问example.com,但仍然是 laravel 的 url('/') 提供 http。
    • @Rejaul 您的 LB 监听器可能有问题。如果它们是 https,您可以仔细检查它们吗?
    • 已解决。我已经配置了 Laravel 的可信代理。 laravel.com/docs/5.8/requests#configuring-trusted-proxies
    猜你喜欢
    • 1970-01-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 2015-01-06
    • 2019-04-23
    • 2017-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多