我的东方天使,新年祝贺,斗战神牛魔前期加点
> git clone ****.git
> cd you-project > npm i
// 安装最新的egg包 // 在项目根目录下新建run.js const egg = require('egg'); function normalizeport(val) { const listenport = parseint(val, 10); if (isnan(listenport)) { return val; } if (listenport >= 0) { return listenport; } return false; } const port = normalizeport(process.env.port) || 3000; egg.start({ ignorewarning: true }) .then(app => { app.listen(port); app.logger.info(`server running on ${port} ...`); });
测试启动
> node run.js
> npm i pm2 -g
module.exports = { apps : [{ name: '****', script: 'run.js', // options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/ args: 'one two', instances: 4, autorestart: true, watch: false, max_memory_restart: '4g', env: { node_env: 'development', }, env_production: { node_env: 'production', app_url: '*****', db_host: 'localhost', db_port: '3306', db_username: '*****', db_password: '*****', db_database: '*****', egg_server_env: '****', }, }], };
$ pm2 start ecosystem.config.js --env production
$ pm2 start ecosystem.config.js
参考
参考: https://blog.csdn.net/u013235478/article/details/50623693, 设置mysql开机启动
c:\users\gysd\.pm2
@echo off set homedrive=c: set pm2_home=c:\users\***\.pm2 @rem ensure that pm2 command is part of your path variable @rem if you're not sure, add it here, as follow: set path=c:\users\****\appdata\roaming\npm;%path% @rem optionally, you can add 'pm2 kill' just before @rem resurrect (adding a sleep between 2 commands): @rem pm2 kill @rem timeout /t 5 /nobreak > nul @rem pm2 resurrect @rem otherwise, you can simple call resurrect as follow: pm2 resurrect echo "done"
nssm.exe install mypm2service
pm2_startup.bat
路径
重启查看
参考:
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
新补丁让Windows 10出现死机、卡顿等 微软坐不住称正解决
Ubuntu 20.04 LTS进驻Windows子系统:只能用3年
ThinkPad正式加入:预装Linux发行版而非Win10的PC越来越多了
最新版Android 11推送!谷歌Pixel 5被曝光:支持反向充电
高度致敬Windows!开源优麒麟20.04 LTS发布:支持5年
电脑小知识:Windows 10是用什么语言写的?到底有多少行代码?
Win10 5月更新准正式版:微软引入大量新功能 系统响应速度快
Windows 10新预览版19613推送:修复任务栏图标显示异常BUG
Windows AD 报错解决:UAC File Virtualization服务启动失败 此驱动程序被阻止加载
网友评论