配置server.js文件

    1. /server.js
    2. const egg = require('egg');
    3. const workers = Number(process.argv[2] || require('os').cpus().length);
    4. egg.startCluster({
    5. workers,
    6. baseDir: __dirname,
    7. });

    安装pm2

    1. cnpm i pm2 -g

    启动

    1. pm2 start server.js --name myegg-wechat