如何在EC2的一个实例运行多个应用程序 [英] How to run more than one app on one instance of EC2

查看:153
本文介绍了如何在EC2的一个实例运行多个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个小的生产基地和一堆有趣的业余爱好者/实验应用程序和这样的。我想在一个EC2实例上运行所有的人。

I have a couple of small production sites and a bunch of fun hobbyist/experimental apps and such. I'd like to run all of them on one EC2 instance.

我可以安装的Node.js,NPM,EX preSS和Cou​​chDB的一次,然后运行在不同的端口上的每个应用程序,并调整DNS设置我的域名注册管理机构,以指向相应的地方?

Can I install node.js, npm, express and couchdb once, and then run each app on a different port, and adjust the dns settings at my domain registry to point to the appropriate place?

更新:感谢迈克!对于任何人谁是寻找在EC2上多个IP地址:<一href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html">http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html

Update: Thanks Mike! For anyone else who's looking for multiple IP addresses on EC2: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html

推荐答案

有多种方法去了解它。

您可以在不同的端口上运行的每个Node.js的过程,只需打开端口,走向世界。但是,您的网址将需要对主机为每个项目的最后一个端口。 yoururl.com:8080 / 将技术工作,但可能不是你要找的内容。

You could run each Node.js process on a different port and simply open the ports to the world. However, your URLs would need a port on the end of the hostname for each project. yoururl.com:8080/ would technically work, but probably not what you're looking for.

您可以在一个EC2实例使用多个IP地址,但是,他们提出的每一个约$ 3.65每个月需要支付额外费用。所以,如果你有10个不同的域要承载上一次实例那么这是超过$ 30每月额外的托管费。

You could use multiple IP addresses on one EC2 instance, however, they come with an additional cost of about $3.65 a month each. So if you have 10 different domains you want to host on once instance then that's over $30 a month extra in hosting fees.

在另一面,任何使用SSL的域需要它自己的IP地址。

On the flip side, any domain using SSL needs it's own IP address.

此外,有<一个href="http://aws.amazon.com/about-aws/whats-new/2012/07/06/multiple-ip-addresses-for-amazon-ec2-instances-in-amazon-vpc/">limits将IP地址的数量你可以分配给你一个实例,较小的情况下,较少的IP地址。

Also, there are limits to the number of IP addresses you can assign to an instance and the smaller the instance, the less IP addresses you get.

IP地址的数目,您可以指定由各个实例类型。小的情况下,最多可容纳八超大实例最多可分配240个IP地址(在8个弹性网络接口),8个IP地址(在2个弹性网络接口),而高内存四特大型和集群计算机。有关IP地址和弹性网络接口限制的详细信息,请访问实例家庭和类型在Amazon EC2用户指南中。

The number of IP addresses that you can assign varies by instance type. Small instances can accommodate up to 8 IP addresses (across 2 elastic network interfaces) whereas High-Memory Quadruple Extra Large and Cluster Computer Eight Extra Large instances can be assigned up to 240 IP addresses (across 8 elastic network interfaces). For more information about IP address and elastic network interface limits, go to Instance Families and Types in the Amazon EC2 User Guide.

防爆preSS自带的虚拟主机功能。您可以在基于域名的名也是独一无二的Node.js / EX preSS服务器,并设置路由运行多个领域。 虚拟主机下防爆preSS支持这个。

Express Vhosts

Express comes with virtual host functionality. You can run multiple domains under one Node.js/Express server and setup routes based on domain name. vhost under Express enables this.

您可以设置Nginx的在多个应用程序服务器前面。这具有最大的灵活性。你可以为每个域都有一个Node.js的过程,可以让你在同一时间做更新和重新启动的一个域。它还允许您对主机应用程序服务器,如沿侧相同的EC2实例下的Apache / PHP的Node.js的过程。

You can setup Nginx in front of multiple application servers. This has the most flexibility. You can have one Node.js process per domain which allows you to do updates and restarts on one domain at a time. It also allows you to host applications servers such as Apache/PHP under the same EC2 instance along side your Node.js process.

使用Nginx的作为一个反向代理,你也可以在同一个域托管的不同的应用服务器,但服务于不同的路径。

With Nginx acting as a reverse proxy you could also host different application servers under the same domain, but serving different paths.

例如,Node.js的可以成为一个领域的主要根路径,但你可以设置 /博客/ 路径去的Apache / PHP /字preSS设置在同一个EC2实例。

For instance, Node.js could serve the main root path of a domain but you could setup the /blog/ path to go to a Apache/PHP/Wordpress setup on the same EC2 instance.

这篇关于如何在EC2的一个实例运行多个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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