Poipoi
Poipoi

Reputation: 225

AWS EC2: keep running node.js after exit console

I use aws ec2 to host web server with node.js and apache.

So far, I always need to login ec2 through terminal to run npm start.

I wanna make it keep running even if Im not on terminal. How am I supposed to setup for it?

I turned on https, but nothing happened.

I appreciate it in advance.

Upvotes: 4

Views: 1125

Answers (1)

NodeNewb
NodeNewb

Reputation: 71

One option is using the screen command:

screen

You will reach a new bash prompt for that screen. Run your app.

To detach the screen, press Ctrl+A, then D to detach from that screen.

To reattach screen when you next SSH in, use

screen -ls 

to see detached screens and use

screen -r xxxxx

with the screen number to reattach that screen.

Upvotes: 2

Related Questions