托管nodejs在EC2应用 [英] hosting nodejs application in EC2
问题描述
我感兴趣的主办nodejs应用程序在云中,我寻找免费的云托管了点。我发现,亚马逊有这个,所以我有以下问题:是否有任何教程,我怎么能站起来,在Amazon EC2上运行nodejs应用
I'm interesting in hosting nodejs applications in a cloud and I'm looking for free cloud hosting for that. I've found that Amazon has this that, so I have the following question: Are there any tutorials how can I get up and running nodejs application in Amazon EC2?
修改:你能提供什么好的hostings为nodejs除了Heroku的
EDIT: Can you provide any good hostings for nodejs except heroku?
推荐答案
我一直在使用Node.js的与亚马逊EC2了一段时间,很高兴与他们两人所。就目前AWS似乎是最便宜,最强大的云服务提供商,所以拿起亚马逊不会是一个错误。没有什么特别的Node.js的运行在云中 - 你使用它一样,如果它是你自己的电脑。下面是一些常规步骤要遵循的EC2 Ubuntu的服务器上运行的最简单的Node.js应用:
I've been using Node.js with Amazon EC2 for a while and was quite happy with both of them. For the moment AWS seems to be the cheapest and the most robust cloud provider, so picking up Amazon wouldn't be a mistake. There's nothing special about running Node.js in the cloud - you work with it like if it were your own PC. Below are some general steps to follow for the simplest Node.js application running on EC2 Ubuntu server:
-
创建亚马逊EC2帐户。
从AWS控制台启动 t1.micro
实例(<一href="https://whatiscomingtomyhead.word$p$pss.com/2010/11/24/absolute-first-step-tutorial-for-amazon-web-services/">example).
From AWS console start t1.micro
instance with any Ubuntu AMI (example).
通过SSH到您的实例登录。
Login via SSH to your instance.
安装的node.js:命令和apt-get安装nodejs
Install node.js: sudo apt-get install nodejs
创建新的文件 test_server.js
包含以下内容:
Create new file test_server.js
with the following content:
require("http").createServer(function(request, response){
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World!");
response.end();
}).listen(8080);
启动服务器:节点test_server.js
检查它是从另一个控制台工作:卷曲的http://本地主机:8080
Check it's working from another console: curl http://localhost:8080
这篇关于托管nodejs在EC2应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!