带有HTTPS的Ubuntu 18.04 EC2实例上的Apollo服务器 [英] Apollo Server on Ubuntu 18.04 EC2 instance with HTTPS

查看:102
本文介绍了带有HTTPS的Ubuntu 18.04 EC2实例上的Apollo服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Amazon Web Services(AWS)EC2在Ubuntu 18.04实例上部署我的简单阿波罗服务器.它工作正常,但我需要/希望流量改为通过HTTPS.我想知道哪个可能是最佳选择.我使用"forever"("forever start lib/index.js")运行代码,也使用yarn(启动项目"yarn start").我可以使用ip地址()访问服务器,并且一切正常.我想尽快做到,已经尝试过apollo-server-lambda和其他Node.js托管网站.

i'm trying to deploy my simple apollo-server on an Ubuntu 18.04 instance from Amazon Web Services(AWS) EC2. It works fine, but i need/want the traffic to be over HTTPS instead. I was wondering which could be the best option. Im running the code with "forever"("forever start lib/index.js"), also using yarn (to start the project "yarn start"). I'm able to access the server with the ip address () and everything works fine. I would like to do it ASAP, already tried with apollo-server-lambda and others Nodejs hosting websites.

推荐答案

在AWS上执行此操作的更简单方法是使用EC2负载平衡器.您只需要创建一个应用程序负载平衡器,然后将您的实例添加到目标组即可.一旦创建了负载均衡器,就可以轻松地在负载均衡器上应用SSL证书.这种方法根本不需要您更改应用程序代码.

The easier way to do this on AWS is by using a EC2 load balancer. You just need to create an application load balancer and add your instance to the target group. Once you have the load balancer created, you can apply the SSL certificate easily on your load balancer. This approach doesn't require you to change your application code at all.

请参阅此文档. https://docs.aws.amazon. com/elasticloadbalancing/latest/application/create-application-load-balancer.html

如果您不想使用负载平衡器,则需要在应用程序级别应用SSL证书.希望这会有所帮助.

If you don't want to use a load balancer, you need to apply the SSL certificate on the application level. Hope this helps.

这篇关于带有HTTPS的Ubuntu 18.04 EC2实例上的Apollo服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆