我配置好服务器,上传node.js的express项目
远程使用iterm连接服务器
ssh root@xxxxxxxx
进入到express项目目录执行
npm start启动项目
终端显示启动 ./bin/www成功
打开外网网址
显示正常网址
但是当我关闭终端或者使用control+C退出的话
重新刷新网页,出现
请问大家是如何处理这个事情的,我远程启动了项目,但是我总不能一直在我这边开着这个终端吧
迷茫2017-04-17 15:59:02
nohup command &
或者tmux
Simply put, your program process is a child process of ssh, so when the parent process exits, the child process will also exit.
巴扎黑2017-04-17 15:59:02
Understand the principles of SIGHUP and learn to use one or more of nuhup/screen/tmux/service management (initd or systemd)
PHP中文网2017-04-17 15:59:02
When the terminal is closed, all processes belonging to it end. You can use pm2, or simply add &
(with space)
PHPz2017-04-17 15:59:02
Express has an advanced chapter, the address is here http://expressjs.com/zh-cn/ad..., you can use the process manager to close the terminal server and the nodejs project is still running, you can check it out