使用“永远"仍然是将 nodejs 作为 linux/unix 服务运行的建议方法吗? [英] Is using 'forever' still the suggested approach to run nodejs as a linux/unix service?

查看:58
本文介绍了使用“永远"仍然是将 nodejs 作为 linux/unix 服务运行的建议方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几年里,NodeJS 成为服务器领域的主要参与者 - 我真的很难相信没有像样的方式让 nodejs 作为服务在 linux 机器上运行.在 Windows 上,我们有 iisnode - 但对于非 Windows 环境,建议使用永久包作为解决方案 - 而不是真正的解决方案.

In the past couple of years NodeJS became a major player in the server landscape - and I really find it hard to believe that there is no decent way to have nodejs run as a service on a linux box. On Windows we have iisnode - but for non Windows environments the forever package is suggested as the way to go - instead of a real solution.

是否有我找不到的 nodejs 服务化版本?

Is there maybe a servicized version of nodejs out there that I could not locate?

推荐答案

按照您的想法,没有可用的 Node.js 的服务化"版本.保持您的 Node 应用程序运行(例如在发生致命错误时)完全取决于您.

There isn't a "servicized" version of Node.js available in the sense you are thinking. Keeping your Node application running (for example in the event of a fatal error) is up to you entirely.

正如第一条评论中所建议的,这是相当主观的,但实际上有两个大包(以及一两个替代方法)可以从您的 Node 应用程序中创建服务.正如您所提到的,forever 是一种流行的选择.如果你从来没有看过 pm2,我建议你这样做,因为它提供了一些永远才不是.或者,您可以搜索有关 supervisord 的信息,我过去曾在此方面取得成功.最后,使用 upstart 是值得关注的.

As suggested in the first comment, this is fairly subjective, but really there are two big packages (and one or two alternative methods) for making a service out of your Node application. As you've mentioned, forever is a popular choice. If you've never taken a look at pm2, I suggest doing so, as it offers some services that forever does not. Alternatively, you could search for information on supervisord, which I've had success with in the past. Finally, daemonizing Node with upstart is something to look at if the others don't fit well for you.

这篇关于使用“永远"仍然是将 nodejs 作为 linux/unix 服务运行的建议方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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