在Elastic Beanstalk

时间:2017-03-05 17:06:44

标签: amazon-web-services ssl elastic-beanstalk load-balancing

好的,所以我非常接近将我的亚马逊生成的SSL终止在ALB上,该ALB放在我在Elastic Beanstalk上运行的Web应用程序之前。

到目前为止,我所做的是将一个名为alb-secure-listener.config的文件添加到我的应用程序目录的根目录中的.ebextensions文件夹中,该文件的内容如下:

option_settings:
    aws:elbv2:listener:443:
        DefaultProcess: https
        ListenerEnabled: 'true'
        Protocol: HTTPS
        SSLCertificateArns: arn:aws:acm:us-east-1:#############:certificate/####################################
    aws:elasticbeanstalk:environment:process:https:
        Port: '443'
        Protocol: HTTPS

所有###&#39的行都替换为我的SSL ARN。

现在当我打开https://mywebapp.com时,我得到一个" 502 Bad Gateway"页面而不是我的webapp,但该页面 - 我想要使用的SSL证书保护。

打开http://mywebapp.com会正常显示网站。

我想某处有疏忽,但我还没弄清楚它是什么,如果有人有线索请告诉我:D

1 个答案:

答案 0 :(得分:10)

您需要告诉ALB通过端口80上的HTTP与EC2实例进行通信。将最后两行更改为:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="viewport" content="width=device=width, initial-scale=1.0">
	  <title></title>
       <meta name="author" content="">
    <link rel="icon" type="image/png" href="img/icon.png"/>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<link href="css/sticky-footer.css" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css?family=Nunito|Nunito+Sans|Playfair+Display" rel="stylesheet">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<!-- Latest compiled and minified CSS -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<!-- Latest compiled and minified JavaScript -->
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	</head>
<body>
	<header>
		  <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
              <a class="navbar-brand" href="http://"><img onload="this.style.opacity='1';" class= "logo" src="img/logo.png"></a>
      </div>
      <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
      <li class="navbar-left"><a href="http://www">TRAVEL</a></li>
		  <li class="navbar-left"><a href="http://www"> PORTFOLIO </a></li>
      <li class="navbar-left"><a href="http://www"> INSPO </a></li>
		  <li class="navbar-left"><a href="http://www"> ABOUT </a></li>
        </ul>
      <ul class="nav navbar-nav navbar-right">
		  <li class="right"> <a href="https://www.instagram.com/"><i class="fa fa-instagram"></i></a></li>
      <li class="right"> <a href="https://dribbble.com/"><i class="fa fa-dribbble"></i></a></li>
      <li class="right"> <a href="https://www.pinterest.com/"><i class="fa fa-pinterest"></i></a></li>
      <li class="right"> <a href="https://twitter.com/"><i class="fa fa-twitter"></i></a></li> 
        </ul>
      </div>
      <!--/.nav-collapse -->
    </div>
    <!--/.container-fluid -->
  </div>
</div>
	</header>
<!---End Header-->
	<section class="banner">
		<div class="banner-inner">
			<img onload="this.style.opacity='1';" class="banner" src="img/background.jpg">
		</div>
	</section>
<!---End Banner-->
<!-- Begin page content -->
    <footer class="footer">
      <div class="container">
        <span class>Copyright &copy; 2017. JH. All rights reserved.</span>
      </div>
    </footer>
<!---End Footer-->
<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>