通过AWS Elastic Beanstalk访问Node.js服务器

问题描述 投票:0回答:0

通过Elastic Beanstalk访问我的Node服务器时遇到问题。

我所做的过程:

  1. 通过openssl创建自签名证书
  2. 设置弹性beantalk环境。 将安全组设置为使用端口8443入站,出站所有流量。
  3. 上载到负载均衡器
  4. 使用端口8443创建新的侦听器。附加SSL证书。 禁用其他端口。
  5. 上载服务器代码。 附加部分代码。

     var https = require('https'); var express = require('express'); var app = express(); // other packages ... app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.get('/path', function (req, res) { // ignore .. }); https.createServer(function (req, app) { // ignore .. }).listen(8443); 

还尝试以这种方式进行设置:

 app.set('port', process.env.PORT || 8443);
 app.listen(app.get('port'));

当我尝试通过进行访问时,这两种方式似乎都不适合我

https://xxxx-env.xxxx.us-west-2.elasticbeanstalk.com

基于我在这里找到的参考( 使用NodeJS时如何在AWS EC2上下载证书和私钥 ),我认为创建https服务器时不需要设置证书。

这是否意味着我必须购买证书而不是使用自签名?

谢谢!

node.js amazon-web-services elastic-beanstalk amazon-elastic-beanstalk
© www.soinside.com 2019 - 2024. All rights reserved.