How to keep Nodejs running

software development


I have a nodejs running on one of my domains. I run npm start to start the server. Everything works just fine. However, when I close the terminal is kills the process and my website doesnt work anymore. All the answers on the web say to use the command forever but forever is not installed on the VPS. To install forever I need sudo access and we are not given sudo access on VPS.

How do I run my node server so it stays running?


See if this can help you:

I never installed Node.JS so I can’t say if it can be done this way, but I have some permanent processes on my VPS (memcache and two python scripts). In the good old IRC days I also used to run eggdrop that way (not here, obviously).


Agreed that the post referenced is a good suggestion, just run nohup nom start & and it will keep running when you close your terminal.


Hi Gary, have you already tried enabling Passenger on your domain as described on ? That should do the trick. Let us know if you have other issues with it, happy to help you troubleshoot.


Neither of these work. I have passenger enabled and I tried the nohup nom start & suggestion. It ran my server for about a day and then the process was killed.

I am seriously confused why Dreamhost just doesn’t have forever command installed on the VPS.


I did the things that were suggested but the node app still does not continue running when I close the terminal.


The key is this line, “I close putty, then I cannot reach the address”

When you are logged into your remote host on Putty you have started an SSH linux process and all commands typed from that SSH session will be executed as children of said process.

Your problem is that when you close Putty you are exiting the SSH session which kills that process and any active child processes. When you close putty you inadvertently kill your server because you ran it in the foreground. To avoid this behavior run the server in the background by appending & to your command:

node /srv/www/MyUserAccount/server/server.js &
The problem here is a lack of linux knowledge and not a question about node. For some more info check out: