Reputation: 1235
I have an Amazon EC2 Server where i have configured the node js server, it is not accessible from the outside by the public dns but it is accessible by the same instance(localhost). Any help will be much appreciated.
Server Code :
var my_http = require("http");
my_http.createServer(function(request,response){
console.log("Request Recieved : "+request.url);
response.writeHeader(200, {"Content-Type": "text/plain"});
response.end("Server is UP \n");
}).listen(3000, "0.0.0.0");
console.log("Server is Running on Port 3000");
netstat output
netstat -tupln | grep :3000
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 11706/node
curl output
curl http://127.0.0.1:3000 => Server is UP
curl http://localhost:3000 => Server is UP
curl http://{PRIVATE_IP}:3000 => Server is UP
curl http://{PUBLIC_DNS}:3000 => curl: (52) Empty reply from server
Upvotes: 0
Views: 268
Reputation: 839
It does sound like a security group issue.
In your EC2 control panel, locate your instance and scroll all the way to the right. There is a Security Group column, and if you haven't changed the default name your security group will be called something like "launch-wizard-1".
Click it, and that opens a filtered list of security groups (there will probably be just one entry in the list).
Right-click it and select Edit Inbound Rules.
Add a rule that says:
Type: HTTP
Protocol: TCP
Port Range: 3000
Source: Anywwhere
Save and it should work.
Upvotes: 2