简体   繁体   English

在我的服务器上部署Node js应用程序

[英]deploy node js application on my server

I'm trying to learn node js. 我正在尝试学习节点js。 I have a basic "hello world" running on localhost with this code : 我在本地主机上运行了一个基本的“ hello world”,其代码如下:

require('http').createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');}).listen(1337, "127.0.0.1");

Now I'm trying to deploy it on a server I got from someone to fiddle around on with node.js installed on. 现在,我正在尝试将其部署在我从某人那里安装了node.js的服务器上。

How do I get "hello world" to appear on my page: thomas.sitestatus.nl? 如何使“ hello world”出现在我的页面:thomas.sitestatus.nl? I have checked multiple tutorials and I still haven't find a solution. 我检查了多个教程,但仍然没有找到解决方案。

Here is some basic steps you can follow to run your application on the server. 您可以按照以下一些基本步骤在服务器上运行应用程序。

1) Copy your project to the server. 1)将项目复制到服务器。 Install npm modules if needed. 如果需要,请安装npm模块。

2) Then start the application on some port like 3000 (Later you can use nginx to map it to port 80) 2)然后在某个端口(例如3000)上启动应用程序(以后可以使用nginx将其映射到端口80)

3) After that when you enter thomas.sitestatus.nl:3000 in your browser, you will see "Hello World". 3)之后,当您在浏览器中输入thomas.sitestatus.nl:3000时,您将看到“ Hello World”。 If you configure nginx, entering thomas.sitestatus.nl will show "Hello World". 如果配置nginx,则输入thomas.sitestatus.nl将显示“ Hello World”。

Feel free to ask if you have doubts or questions. 随时询问您是否有疑问或疑问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM