为什么node js项目不在阿里巴巴云上的IP地址上运行

问题描述

我已经在阿里云上成功部署了 node js 项目并在端口 2021 和 2020 上运行我已经导出了该端口号并且还在阿里云实例的 ECS 上添加了。

当我运行命令 pm2 start 0,1 时,它的状态是在线的,但是当我在浏览器上使用 IP 地址点击该端口号时,它不起作用我谷歌它并花了很多时间但没有找到任何解决方案这是我的第一次部署提前感谢阿里云任何帮助。

enter image description here

enter image description here

enter image description here

enter image description here

解决方法

根据提供的屏幕截图,应用程序不断重启,因此应用程序似乎不够稳定,无法接受连接。

尝试使用端口卷曲服务器上的应用程序并检查它是否返回以下答案

  • curl http://localhost:2000
  • curl http://localhost:2021

可以在此处找到有关 curl 请求的更多信息 https://blog.logrocket.com/an-intro-to-curl-the-basics-of-the-transfer-tool/

如果没有答案,请尝试通过运行检查日志

pm2 logs