I know this is an old question, but for new visitors who identify with him, Iβm going to go to the final destination and assume that you want to run a web application that works constantly: one that can serve visitors at your IP address , day and night. If this is not the case, then screen or nohup may work fine, but if it is, it is best to use a daemon such as pm2 or forever .
Perhaps daemons are the best way to constantly maintain the service ... for example, how does your Ubuntu instance know when you want to communicate with it through SSH? This is due to sshd, the SSH daemon. The daemon has a code that always listens, just as you would like a web application to do.
In addition, pm2 and forever have other useful features, such as reloading the daemon if a crash and reboot occurred on your computer.
source share