如何在 EC2 AWS 实例中启动节点 js 项目

how to start node js project in a EC2 AWS instance

我是 node js 的新手,我正在尝试在 EC2 中设置它 AWS.I 尝试使用命令“npm start”但没有任何反应

下面是我的package.json

{
  "name": "sample",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "cookie-parser": "~1.4.4",
    "debug": "~2.6.9",
    "ejs": "~2.6.1",
    "express": "~4.16.1",
    "http-errors": "~1.6.3",
    "morgan": "~1.9.1",
    "pm2": "^5.1.2"
  }
}bouldercef$ npm start

在 运行 npm 启动后出现以下行,但无法看到该站点

boulder@0.0.0 start /home/ubuntu/bouldercef

node ./bin/www

如果您的站点 运行 在您的计算机中正常运行,并且如果您在 EC2 实例中安装了 node/npm 并且您没有收到任何错误,那么您的项目看起来是 运行 没有问题。

所以问题可能是您没有使用 HTTP 连接到您的站点。

查看您的实例附加的安全组,以检查您是否允许用户通过 HTTP (80) 或 HTTPS (443) 进行连接。

有关如何使这些端口可供您的用户使用的更多信息,请查看 How do I allow my users to connect on HTTP (80) or HTTPS (443)?