gpt4 book ai didi

amazon-web-services - 运行反向代理的 Elastic Beanstalk 上的 TLS

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

我想将 TLS 添加到我的 AWS Elastic Beanstalk 应用程序。它是一个在 nginx 代理服务器后面运行的 node.js 应用程序。

这是我完成的步骤

  1. 从 Amazon Certificate Manager 获取通配符证书。
  2. 在我的 EB 实例的负载均衡器配置部分添加证书。

enter image description here

我的 nginx 配置的相关部分是

files:
/etc/nginx/conf.d/proxy.conf:
mode: "000644"
content: |
upstream nodejs {
server 127.0.0.1:8081;
keepalive 256;
}

server {
listen 8080;

proxy_set_header X-Forwarded-Proto $scheme;
if ( $http_x_forwarded_proto != 'https' ) {
return 301 https://$host$request_uri;
}

location / {
proxy_pass http://nodejs;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

当我尝试使用 https 访问我的应用程序时,我收到了 408:请求超时

据我了解,要在 nginx 上启用 ssl,我们需要将证书与 pem 文件一起添加并在端口 443 上监听。但是由于我使用的是 ACM 证书,所以我没有证书和 pem 文件。

为了让它工作,我缺少在我的 nginx.conf 中添加什么?

谢谢

最佳答案

在负载均衡器监听器配置中,对于端口 443 监听器,“实例端口”设置应为 80

关于amazon-web-services - 运行反向代理的 Elastic Beanstalk 上的 TLS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52203545/

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