qwerty-learner
qwerty-learner copied to clipboard
如何部署在Ubuntu后台长期运行
第一次接触nodejs,部署在内网的Ubuntu上给学生做课前练习,通过ssh登录服务器启动网站,现在发现ssh客户端一断开,网站就访问不了
@lixun2015
用linux screen by gnu
更新apt和安装screen: sudo apt update && sudo apt install screen
然后启动一个screen screen -S qwerty-server
启动完服务器后
ctrl-a + d detach screen就好了
用 pm2 对 nodejs 进行进程守护
https://pm2.io/docs/runtime/guide/installation/
https://pm2.io/blog/2018/04/20/Node-js-clustering-made-easy-with-PM2