Coder Social home page Coder Social logo

Comments (16)

yi-ge avatar yi-ge commented on May 11, 2024

这个只是一个脚手架,用的是koa2,它已经非常稳定可靠。可以使用pm2进行进程守护。此外,如果进程挂掉,一定有原因,需要找出来,确保线上业务不出问题。

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

pm2 start pm2.js 启动,访问不行呢

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@laiyiyi 请使用pm2 logs查看错误日志。

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@yi-ge大佬 日志没东西的,
image

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@laiyiyi curl http://127.0.0.1:你的端口,看下能不能正常返回。然后看防火墙以及到服务器控制面板,看一下控制面板的端口开放了没有。

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@yi-ge 不行啊 返回curl: (7) Failed to connect to 127.0.0.1 port 3000: Connection refused
npm run dev 这样启动,就正常。

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@yi-ge 大佬,那个pm2 start pm2.js 在你那能正常启动吗? 这种方式没效果,我只能直接pm2 start ./dist/app.js -i 1 这样直接在命令上配置才行

from koa2-api-scaffold.

Ben-Ben-B avatar Ben-Ben-B commented on May 11, 2024

@laiyiyi 你可以forever试试,我的就是用这个

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@Ben199011 还是没效果,其他项目都没问题

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@laiyiyi 你的报错说明本地端口都没监听,那肯定是启动报错了。贴一下pwd结果及pm2.json内容。

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@yi-ge 大佬,这个是执行过程
http://182.92.215.85:8001/11.gif

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@laiyiyi pm2.json没写对呀。添加cwd。或者用绝对路径。
image

参考:

{
  "apps": [{
    "name": "api",
    "script": "dist/main.js",
    "cwd": "/home/ubuntu/site/",
    "exec_mode": "fork",
    "max_memory_restart": "4G",
    "autorestart": true,
    "node_args": [],
    "args": [],
    "env": {

    }
  }]
}

from koa2-api-scaffold.

beclass avatar beclass commented on May 11, 2024

@yi-ge 原来是这个名字的问题..
http://182.92.215.85:8001/22.gif

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@laiyiyi 还有这种操作🤦‍♀️,谢谢!!谢谢!!

from koa2-api-scaffold.

zhuziyi1989 avatar zhuziyi1989 commented on May 11, 2024

你这启动脚本确实有问题。

from koa2-api-scaffold.

yi-ge avatar yi-ge commented on May 11, 2024

@zhuziyi1989 很抱歉给您带来不便了。启动脚本的只是一个示例,实际使用一定要根据程序本身来修改的。比如说程序不支持微服务化,不支持多服务同时进行,就不能简单的fork启动。

from koa2-api-scaffold.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.