如何在我的专用服务器上安装 Node Js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7049789/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 14:28:16  来源:igfitidea点击:

How do I install Node Js on my dedicated server

node.jscentos

提问by Amen Ra

I have a dedicated server maintained by GoDaddy. I want to run Node Js on it. Is there any documentation available on how to install Node JS on my server? I have a CentOS dedicated server.

我有一个由 GoDaddy 维护的专用服务器。我想在上面运行 Node Js。是否有关于如何在我的服务器上安装 Node JS 的文档?我有一个 CentOS 专用服务器。

采纳答案by yojimbo87

There are several resources about how to install it (recommended is to build from source). For example you can check out these:

有几个关于如何安装它的资源(推荐从源代码构建)。例如,您可以查看这些:

回答by Gaurav Singh

you can get the nodejs configuration from http://nodejs.org/
The important thing you need to keep in your mind is about its configuration in file app.js which consists of port number host and other settings these are settings working for me

你可以从http://nodejs.org/获取 nodejs 配置
你需要记住的重要事情是它在文件 app.js 中的配置,它由端口号主机和其他设置组成,这些设置对我有用

backendSettings = {
"scheme":"https / http ",
"host":"Your website url",
"port":49165, //port number 
'sslKeyPath': 'Path for key',
'sslCertPath': 'path for SSL certificate',
'sslCAPath': '',
"resource":"/socket.io",
"baseAuthPath": '/nodejs/',
"publishUrl":"publish",
"serviceKey":"",
"backend":{
"port":443,
"scheme": 'https / http', //whatever is your website scheme
"host":"host name",
"messagePath":"/nodejs/message/"},
"clientsCanWriteToChannels":false,
"clientsCanWriteToClients":false,
"extensions":"",
"debug":false,
"addUserToChannelUrl": 'user/channel/add/:channel/:uid',
"publishMessageToContentChannelUrl": 'content/token/message',
"transports":["websocket",
"flashsocket",
"htmlfile",
"xhr-polling",
"jsonp-polling"],
"jsMinification":true,
"jsEtag":true,
"logLevel":1};

回答by PTalbot

I found several guides on how to install NodeJS on Linux Distros. I've tested them myself, they work as expected. Since you're running CentOS, the first link may be the most useful.

我找到了几个关于如何在 Linux 发行版上安装 NodeJS 的指南。我自己测试过它们,它们按预期工作。由于您运行的是 CentOS,因此第一个链接可能是最有用的。

CentOS 7

CentOS 7

Ubuntu 14

Ubuntu 14

Ubuntu 16

Ubuntu 16

回答by Amen Ra

I now have a video tutorial walking you through this if your dedicated server is still on GoDaddy Getting Vagrant, Node Js, Nginx, and CENTOS 7 to Work Together

如果您的专用服务器仍然在 GoDaddy 上我现在有一个视频教程可以引导您完成此操作让 Vagrant、Node Js、Nginx 和 CENTOS 7 协同工作