PM2 部署 Ghost 博客
把博客迁到 Ghost 之后,部署是一个比较麻烦的问题。后来发现了 PM2,用了一下,还不错。
安装
sudo npm install -g pm2
运行
NODE_ENV=production pm2 start index.js --name "blog"
也可以把上面命令保存在脚本文件中后执行。
运行成功后如下图所示:
管理
查看运行状态
pm2 ls
重启
pm2 restart blog
停止
pm2 stop blog
运行
pm2 start blog
开机运行
pm2 startup centos
pm2 save
如果服务器是 Ubuntu 那就是 pm2 startup ubuntu
清除
pm2 kill
Subscribe to Tao²
Get the latest posts delivered right to your inbox