Comments (16)
这个只是一个脚手架,用的是koa2,它已经非常稳定可靠。可以使用pm2进行进程守护。此外,如果进程挂掉,一定有原因,需要找出来,确保线上业务不出问题。
from koa2-api-scaffold.
pm2 start pm2.js 启动,访问不行呢
from koa2-api-scaffold.
@laiyiyi 请使用pm2 logs查看错误日志。
from koa2-api-scaffold.
@yi-ge大佬 日志没东西的,
from koa2-api-scaffold.
@laiyiyi curl http://127.0.0.1:你的端口
,看下能不能正常返回。然后看防火墙以及到服务器控制面板,看一下控制面板的端口开放了没有。
from koa2-api-scaffold.
@yi-ge 不行啊 返回curl: (7) Failed to connect to 127.0.0.1 port 3000: Connection refused
npm run dev 这样启动,就正常。
from koa2-api-scaffold.
@yi-ge 大佬,那个pm2 start pm2.js 在你那能正常启动吗? 这种方式没效果,我只能直接pm2 start ./dist/app.js -i 1 这样直接在命令上配置才行
from koa2-api-scaffold.
@laiyiyi 你可以forever试试,我的就是用这个
from koa2-api-scaffold.
@Ben199011 还是没效果,其他项目都没问题
from koa2-api-scaffold.
@laiyiyi 你的报错说明本地端口都没监听,那肯定是启动报错了。贴一下pwd结果及pm2.json内容。
from koa2-api-scaffold.
@yi-ge 大佬,这个是执行过程
http://182.92.215.85:8001/11.gif
from koa2-api-scaffold.
@laiyiyi pm2.json没写对呀。添加cwd。或者用绝对路径。
参考:
{
"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.
@yi-ge 原来是这个名字的问题..
http://182.92.215.85:8001/22.gif
from koa2-api-scaffold.
@laiyiyi 还有这种操作🤦♀️,谢谢!!谢谢!!
from koa2-api-scaffold.
你这启动脚本确实有问题。
from koa2-api-scaffold.
@zhuziyi1989 很抱歉给您带来不便了。启动脚本的只是一个示例,实际使用一定要根据程序本身来修改的。比如说程序不支持微服务化,不支持多服务同时进行,就不能简单的fork启动。
from koa2-api-scaffold.
Related Issues (17)
- 我的promise对象无法生效
- 请教下,这个怎么用vs断点调试呢? HOT 3
- debug报错啊 HOT 2
- 'ctx.request.body.files'问题 HOT 1
- 如何部署线上服务器? HOT 8
- 线上部署问题 HOT 1
- 会出一个TypeScript版本吗? HOT 4
- node.js用什么数据库开发比较好? HOT 1
- 请教下怎么配置https证书 HOT 1
- 能问下登录认证在哪儿弄吗? HOT 1
- 这个脚手架怎么使用呢 HOT 6
- option 请求返回404 HOT 1
- how get token for Authorization HOT 1
- tool.js中getsec()方法未定义 HOT 1
- code ELIFECYCLE HOT 1
- 线上部署问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koa2-api-scaffold.