简体   繁体   English

是否仍然建议使用“永远”将nodejs作为linux / unix服务运行?

[英]Is using 'forever' still the suggested approach to run nodejs as a linux/unix service?

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. 在过去的几年中,NodeJS成为服务器领域的主要参与者-我真的很难相信,没有像样的方法可以让Nodejs作为服务在Linux机器上运行。 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. 在Windows上,我们有iisnode-但对于非Windows环境,建议使用永久软件包作为替代方法-而不是真正的解决方案。

Is there maybe a servicized version of nodejs out there that I could not locate? 是否可能有我找不到的Nodejs的服务版本?

There isn't a "servicized" version of Node.js available in the sense you are thinking. 在您所考虑的范围内,没有可用的“服务化”版本的Node.js。 Keeping your Node application running (for example in the event of a fatal error) is up to you entirely. 保持Node应用程序运行(例如在发生致命错误时)完全取决于您。

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. 正如第一条评论中所建议的那样,这是相当主观的,但是实际上有两个大包(以及一个或两个替代方法)用于从Node应用程序中制作服务。 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. 如果您从未看过pm2 ,我建议您这样做,因为它提供了一些永远不会提供的服务。 Alternatively, you could search for information on supervisord , which I've had success with in the past. 或者,您可以搜索有关过去我曾成功使用过supervisor的信息。 Finally, daemonizing Node with upstart is something to look at if the others don't fit well for you. 最后,如果其他新手不太适合您,则需要用暴发户守护Node。

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

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