Angular 5 Create an Application Source Bundle for AWS EC2

我的梦境 提交于 2019-12-02 00:38:38

The cardinal sin in my question above was attempting to run my Angular 5 app in AWS by using their choice for node.js as my server platform. Here is what I learned (with some help from folks like Albert Haff: Angular 5 uses Node (ng serve) to simulate a webserver while you code. However, even though there is a supported flag for --prod, it's not to be used in production! It's really easy (and tempting) to select node.js as the environment when deploying your Angular 5 app via Beanstalk -- but don't do it!

  1. from within your Angular 5 project folder, run ng build --prod ( and consider adding --aot)
  2. if you can, from within the new /dist folder that the build just created (or updated), optionally run compression like for i in dist/*; do brotli $i; done
  3. from within the /dist folder, zip up ALL the contents including subfolders.
  4. go to beanstalk, and as you create a webserver environment, select Tomcat (or any other plain old webserver, but DON'T pick node.js even though it's on the list!).
  5. on Application Code, select to Upload Your Own, and browse to the .zip file you created in step 3 above.
  6. click Create Environment and in a few minutes your Angular 5 app will be serving up on the internet.

Now, from here you will likely need to connect up your domain name. Use Route 53 for that.

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