使用Forever让Ghost博客和聊天室在后台运行

刚接触nodejs,发现bash一关掉网站就停了。。网上很多文章推荐用PM2进行任务管理,不过听说有些问题,正式环境没有Forever稳定

######Forever的基本操作

`$ sudo npm install forever -g   #安装

$ forever start app.js          #启动

$ forever stop app.js           #关闭

$ forever start -l forever.log -o out.log -e err.log app.js   #输出日志和错误`

######启动Ghost

`NODE_ENV=production forever start index.js`

######重启Ghost

`NODE_ENV=production forever restart index.js`

######其它我用的比较多的是(不能用于启动Ghost

`$ forever start -w app.js`

这样forever会监测文件修改,修改前端样式的时候可以实现实时预览,非常的方便

######PM2基本操作

To install pm2, type `npm install pm2 -g`

To launch Ghost on your server do

`NODE_ENV=production pm2 start index.js –name “Ghost”`

To stop Ghost `pm2 stop Ghost`

To restart `pm2 restart Ghost`

And to reload Ghost without downtime `pm2 reload Ghost`


已发布

分类

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注