I'm trying out vagrant as a local testing server and I'm having difficulty connecting to nodejs app server from the hosting windows machine, but I can connect to nginx server just fine.
My vagrant file:
Vagrant.configure("2") do |config|
config.vm.define "web" do |web|
web.vm.box = "ubuntu/trusty64"
web.vm.network "private_network", ip: "55.55.55.55"
end
config.vm.define "app_0" do |app_0|
app_0.vm.box = "ubuntu/trusty64"
app_0.vm.network "private_network", ip: "55.55.55.1"
end
config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
db.vm.network "private_network", ip: "55.55.55.56"
end
end
My node js index.js(helloworld) from app_0 at 55.55.55.1:
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 80, IP defaults to 127.0.0.1
server.listen(80, '0.0.0.0', function() {
console.log('Listening to port: ' + 80);
});
Which is run with sudo node index.js and is visible locally on the vagrant machine, but I cannot connect to it from hosting machine at 55.55.55.1:80
Please do not mark this duplicate of this: Connect to node js server running on vagrant machine as it does not use port-forwarding.
via legokangpalla
No comments:
Post a Comment