Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
171 views
in Technique[技术] by (71.8m points)

amazon web services - How to enable https for a dev environment on Angular app

I have created a website using angular that I am hosting on AWS EC2. I have done some research into how to get my server to be secure with https, and it looks like here are my options:

  1. use angular, add https into angular app
  2. use AWS, use load balancers and use https listener

However, I am new to both AWS and Angular and don't really know where to go from here. My web server is run on Ubuntu, and the 2 tutorials on AWS are for Windows or Linux. Any resources/suggestions?

question from:https://stackoverflow.com/questions/65651032/how-to-enable-https-for-a-dev-environment-on-angular-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Angular provides the way to run your website on SSL

ng serve --ssl 

Also, you can add SSL cert path in the angular.json file:

{
   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
   "projects": {
       "<PROJECT-NAME>": {
           "architect": {
               "serve: {
                   "options": {
                       "sslKey": "<relative path from angular.json>/server.key",
                       "sslCert": "<relative path from angular.json>/server.crt",
                       ...
                   }, ...
               }, ...
           }, ...
       }, ...
   }, ...
}

you can setup load balancer on EC2 instance using this guide:

https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...