繁体   English   中英

使用 AWS Elastic Beanstalk 重定向到 https 不起作用

[英]Redirection to https not working using AWS Elastic Beanstalk

我已经使用 AWS Elastic Beanstalk 为我的应用程序创建了一个环境。 我已经使用负载均衡器配置启用了 https。 我想将流量从 http 重定向到 https。 我已经尝试了以下所有方法,但它不起作用。

1) 我在我的项目根目录中创建了一个 .ebextensions 文件夹,文件名为 https-redirect-php.config。

2) 文件内容是从以下文件粘贴过来的。 https://raw.githubusercontent.com/awsdocs/elastic-beanstalk-samples/master/configuration-files/aws-provided/security-configuration/https-redirect/php/https-redirect-php.config

3)我创建了文件夹的zip并将其部署在服务器上。

4)我也尝试过使用 eb cli 命令 eb deploy 但它不起作用。

请建议我任何帮助。 我会很感激

解决方案是在.ebextensions目录中添加一个包含以下行的配置文件:

option_settings:
  aws:elbv2:listener:443:
    ListenerEnabled: 'true'
    Protocol: HTTPS

查看配置Elastic Beanstalk环境的负载均衡器以终止HTTPS

转到弹性 Beanstalk -> 配置 -> 负载平衡器 -> 规则

拥有端口和证书后,尝试添加以下规则:

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM