簡體   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