简体   繁体   English

在单个 linux 服务器上运行多个 node.js 项目

[英]Running multiple node.js projects on single linux server

So I have 2 chat bots, one for Twitch and one for Discord, that I want to move from my PC to my linux based server so that they are just running all the time for convenience.所以我有 2 个聊天机器人,一个用于 Twitch,一个用于 Discord,我想将它们从我的 PC 移动到基于 linux 的服务器,以便它们一直运行以方便使用。 Is there any way to do this?有什么办法吗?

Obviously I can run each bot by themselves on the server but I can't figure out if and how to do so.显然我可以在服务器上自己运行每个机器人,但我不知道是否以及如何这样做。

You can use a package like pm2 to run node apps in the background.您可以使用像 pm2 这样的pm2在后台运行节点应用程序。

https://www.npmjs.com/package/pm2 https://www.npmjs.com/package/pm2

sudo npm install pm2 -g

pm2 start your-app.js

You can use pm2 to start both apps, and they'll continue to run after you close the shell.您可以使用 pm2 启动这两个应用程序,它们将在您关闭 shell 后继续运行。

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

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