EC2或S3托管AngularJS应用? [英] EC2 or S3 to host AngularJS app?

查看:75
本文介绍了EC2或S3托管AngularJS应用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想启动AngularJS应用程序的生产版本,我发现Amazon AWS是一个很棒的托管套件。由于AngularJS本质上是静态的,因此可以托管在S3存储中,也可以托管在具有node.js后端的EC2服务器上。

I want to launch a production version of an AngularJS application, and I find Amazon AWS to be an awesome hosting suite. As AngularJS is essentially static it could be hosted on S3 storage, or on an EC2 server with node.js backend.

这两种解决方案中的任何一种都适合我的部署方法,所以问题是,(理论上)我会从一种或另一种获得更好的性能,为什么?在S3上托管专业网站前端有什么问题吗?有人对这两种方法都有经验吗?该站点涉及流音频,视频和潜在的许多用户。

Either of these solutions would suit my deployment method, so the question is, will I (in theory) get better performance from one or the other, and why? Is there anything wrong with hosting a professional website frontend on S3? Does anyone have any experience with both methods? The site involves streaming audio, video and potentially many many users.

任何建议都值得赞赏。

Any advice appreciated.

推荐答案

如果您坚持要使用S3 For Front end,那么在审查您的要求时,我建议您使用 Cloudfront 使用S3时,原因是:

On reviewing your requirement if you are adamant about using S3 For Front end , I would like to suggest you use Cloudfront With S3 , the reason being:


S3无法处理自定义HTTP路由。由于导出不是文件S3,
不知道该怎么做。为了正确处理Angular路由
,您必须使用实际的HTTP服务器,例如Nginx,Apache,IIS。

S3 can't handle custom HTTP routes. Since "export" isn't a file S3 doesn't know what to do. In order to properly handle Angular routes you must use an actual HTTP Server like Nginx, Apache, IIS.

阅读这些博客文章以获取更多信息:

You can read these blog posts for more information :

如何使用S3在AWS中托管Angular 2应用程序

使用AWS CloudFront为S3上托管的SPA服务

现在转到使用EC2 To host提到的第二个选项,我认为使用该选项将使您对环境有更多的控制,并且在扩展方面也更具灵活性。

Now Moving to second option you mentioned using EC2 To host , I think using that option would give you more control over your environment and more flexibility on scaling too.

谢谢

这篇关于EC2或S3托管AngularJS应用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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