Reputation: 4466
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.
Upvotes: 2
Views: 3735
Reputation: 1587
Try with
curl 192.168.1.?
check the inet address with ifconfig for example.
Upvotes: 0
Reputation: 38849
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.
Upvotes: 8