使用 HTTPS 的 Ubuntu 18.04 EC2 实例上的 Apollo Server [英] Apollo Server on Ubuntu 18.04 EC2 instance with HTTPS

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

问题描述

我正在尝试在来自 Amazon Web Services(AWS) EC2 的 Ubuntu 18.04 实例上部署我的简单 apollo-server.它工作正常,但我需要/希望流量通过 HTTPS 代替.我想知道哪个可能是最好的选择.我使用永远"(永远启动 lib/index.js")运行代码,也使用纱线(启动项目纱线启动").我可以使用 ip 地址 () 访问服务器,并且一切正常.我想尽快完成,已经尝试过 apollo-server-lambda 和其他 Nodejs 托管网站.

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 Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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