Monitor in production: $ pm2 monitor Make pm2 auto-boot at server restart: $ pm2 startup To go further checkout: http://pm2.io/ --- [PM2] Spawning PM2 daemon with pm2_home=/home/ubuntu/.pm2 [PM2] PM2 Successfully daemonized [PM2] Starting /home/ubuntu/byby/07-wechat/app.js in ...
pm2 start app.js --name my-app 设置开机自启: 代码语言:txt 复制 pm2 startup systemd 保存当前进程列表,以便在重启后恢复: 代码语言:txt 复制 pm2 save 通过以上步骤,你可以控制PM2在系统重启时的行为,确保它符合你的需求。如果需要进一步的帮助或有其他问题,请随时提问。
2 我们要设置环境变量为“production”生产模式!“index.js”是程序启动的入口。最后给这个PM2的进程命名为"ghost" 于是,执行下面的命令:NODE_ENV=production pm2 start index.js --name "ghost"3 让PM2知道在开机后自动运行我们的网站:1.Ubuntu 系统:pm2 startup ubuntu2.CentOS系统:pm2 startup centos3....
When I setup my Ubuntu 18.04 server on the first time, I ran pm2 start app.js to start my app. Then when I tried to run pm2 startup + pm2 save to restart the app on boot, this seemed to be not working, as by running systemctl list-units, pm2 didn’t show up in the services...
首先save(服务器所在用户下:deploy ) pm2 save save.png 之后删除之前的启动脚本 pm2 unstartup ubuntu unstartup .png 创建新的启动脚本 pm2 startup ubuntu -u deploy --hp /home/deploy startup .png ps : -u 当前用户 -hp 用户的根目录
.UseStartup<Startup>(); } } 发布我们的项目,然后在ubuntu的home文件下新建一个api文件夹并把发布文件copy到这里。 使用cd /home/api命令进入我们发布文件夹下。 使用dotnet Api.dll命令运行我们刚才的项目 可以看到我们的项目已经跑起来啦。我们使用浏览器来访问我们的Api看看是否成功 ...
pm2 startup systemd systemd: Ubuntu 16 使用的是 systemd。 你会看到要用 root 用户运行命令的信息。使用exit命令回到 root 用户然后运行命令。 sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u yume --hp /home/yume ...
pm2 start app.js -- -p 8080 pm2 start app.js --node-args="--debug=7001 --trace-deprecation" 命名应用 NODE_ENV=production pm2 start index.js -n Ghost 生成服务脚本 pm2 startup <ubuntu|centos|gentoo|systemd> #产生init脚本,保持进程活着 ...
自动重启:为了确保应用程序的高可用性,可以配置pm2自动重启进程。可以使用pm2 startup命令生成一个启动脚本,并将其注册为系统服务,以便在服务器重启时自动启动pm2进程。 优化应用程序:如果pm2进程频繁崩溃,可能是应用程序本身存在问题。可以通过优化代码、增加错误处理机制、减少内存占用等方式来提高应用程序的稳定...
如何在Ubuntu上使⽤pm2和Nginx部署Node.js应⽤pm2 是⼀个 Node.js 应⽤的进程管理器,它可以让你的应⽤程序保持运⾏,还有⼀个内建的负 载均衡器。它⾮常简单⽽且强⼤,你可以零间断重启或重新加载你的 node 应⽤,它也允许你为 你的 node 应⽤创建集群。-- Muhammad Arul 本⽂导航 ...