Node.js的重新启动对OpsWorks亚马逊每一分钟? [英] Node.js restarting every minute on OpsWorks amazon?

查看:211
本文介绍了Node.js的重新启动对OpsWorks亚马逊每一分钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用OpsWorks在AWS上亚马逊。我订的Node.js应用程序就可以了,当我部署它的一切工作,因为它应该,但是我的主要脚本(server.js)正在重新启动完全的每一分钟。这是code是这样的:

I use OpsWorks on AWS amazon. I have set node.js app on it and when I deploy it everything works as it should, however my main script (server.js) is being restarted exactly every minute. This is what code looks like:

var database = require('./database');
var config = require('./config.json')['development'];

console.log('started');

process.on('uncaughtException', function(err) 
{        
    console.log(err);
});

foo();

function foo()
{   
    // some code
    setTimeout(foo, 2000);
}

为什么我会打印出开始每一分钟?

Why do I get printed out "started" every minute?

推荐答案

OpsWorks会检查你的应用程序中的每一分钟的健康并重新启动它的健康检查(HTTP GET)失败。重新启动它每分钟的事实表明,健康检查失败。请确保您的应用程序侦听端口80。

OpsWorks checks the health of your app every minute and restarts it the health check (HTTP GET) fails. The fact it is restarted every minute suggests that the health check is failing. Make sure your app listens to port 80.

应用程序必须侦听端口80(HTTP请求)或443(HTTPS请求)。

The application must listen on port 80 (for HTTP requests) or port 443 (for HTTPS requests).

如果你还有问题,请确保您的应用程序满足本文档中规定的条件:的部署的Node.js应用

if you still have issues, make sure your app meets the conditions laid out in this doc: Deploying Node.js Apps

这篇关于Node.js的重新启动对OpsWorks亚马逊每一分钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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