简体   繁体   中英

Strongloop deploy on AWS EC2

I have instaled node.js and npm on EC2 through command line and also uploaded all my files for Strongloop project When I'm running the server locally it is working fine but when I'm running the node server.js on EC2 command line. it is running but saying:

Web server listening at: http://0.0.0.0:3001/ ENVIRONMENT : development

How could I start my server on AWS EC2... Can't figure it out.

My Config.json file

{
"restApiRoot": "/api",
"host": "0.0.0.0",
"port": 3001,
"remoting": {
"context": {
  "enableHttpContext": false
},
"rest": {
  "normalizeHttpPath": false,
  "xml": false
},
"json": {
  "strict": false,
  "limit": "100kb"
},
"urlencoded": {
  "extended": true,
  "limit": "100kb"
},
"cors": false,
"errorHandler": {
  "disableStackTrace": true
}
 },
 "legacyExplorer": false
}

Few possible things:

  1. Make sure the port you are using is in your AWS Security Inbound Rules. Go to 'Security Groups', then select the group associated with your instance then click "Inbound". In your case, you have to add the port 3001 for HTTP protocol and the source 0.0.0.0/0.

  2. You need to keep the service running even after you close the terminal/command-prompt window. To make the server start automatically and run in the background, you need to use something like 'systemctl' in ubuntu. Here is a step by step guide and tutorial: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

  3. Now try visiting your IPv4 Public IP or your associated domain name with the port number. eg 1.2.3.4:3001 or mywebsite.com:3001. The IP is written in the same row as your instance in AWS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM