2

I am using a ec2 server running ubuntu and nodejs. I thought this would create a valid server that would respond if I went to my ec2 web address.

var http = require("http");
var port = 80; 
var serverUrl = "0.0.0.0";
console.log("Starting web server at " + serverUrl + ":" + port); http.createServer(      
function(req, res) {
  timestamp = new Date();
  console.log("Request for URL " + req.url + " received at " + timestamp);
  if (req.url === '/error') {
    console.log('Throwing an error');
    throw "Oops";
  }
  res.end("Hello World " + timestamp);
}).listen(port, serverUrl);

I have used nodejs and espesially express for a while but never have tried to deploy it myself on a vps, any advice is appreciated.

2

2 Answers 2

8

Make sure you have port 80 open on the EC2 Security Group.

Test that it's answering on port 80 by by using curl from the machine's command line.

curl -v http://localhost/

If it's answering via a local curl, you probably just have a firewall issue.

1
  • Thanks, I have the same issue. But tests prove it to be fine - 'connected [...] Accept: /', though the app seems to hang on 0.0.0.0 Aug 28, 2013 at 17:00
0

Try with

curl 192.168.1.?

check the inet address with ifconfig for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.