Nhor
Nhor

Reputation: 3940

Node.js Express server terminates after a while

I am hosting Node.js Express server on AWS EC2 instance using nginx for reversed proxy. I am facing a problem, because it terminates connection after some time (possibly 1 hour). I am running the server with a simple commmand:

node app.js &

This makes my server to work fine but only for the first hour (or something about that). Then when I want to connect to the server I'm getting 502 Bad Gateway, so I assume something terminates my application. Can anyone tell me what am I missing?

Upvotes: 0

Views: 66

Answers (1)

Mark B
Mark B

Reputation: 200501

Your code could be encountering an error, causing Node to stop. You should look into using something like Forever to keep your Node application running.

Upvotes: 2

Related Questions