Apollo Server on Ubuntu 18.04 EC2 instance with HTTPS

二次信任 提交于 2020-03-06 10:57:48

问题


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.


回答1:


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.

Please refer this docs. https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-application-load-balancer.html

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://stackoverflow.com/questions/59043089/apollo-server-on-ubuntu-18-04-ec2-instance-with-https

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!