I'm using a Centos VM hosted on OSX using Vagrant and cannot seem to connect to Node.js running on the guest Centos machine.

I have installed both Nginx and Node.js and have forwarded ports from the host to the guest for both of them.

config.vm.network :forwarded_port, guest: 8080, host: 8080 
config.vm.network :forwarded_port, guest: 8124, host: 8124

After starting Node.js I can access it locally within the virtual machine by 'wget' but from the host machine that doesn't work.

I can access the Nginx instance on port 8080 from the host machine without problem. Although I'm planning to run the Node.js on port 8124, stopping Nginx and then running Node.js on port 8080 (which is definitely being forwarded to the Centos VM) still doesn't work.

I have stopped the Iptables service so don't think that would be blocking any requests.

What do I need to do to make Node.js accept requests from the host machine when it is running in the Centos guest VM?

The Node script I'm running is https://github.com/guzzle/guzzle/blob/master/tests/Guzzle/Tests/Http/server.js however I don't think that's relevant as the requests are reaching the node server.

1 Answer 1



See line 132. Your app is bound to only the loopback interface. A quick netstat should confirm that.

$ sudo netstat -ltpn | grep 8124
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0  *               LISTEN      node

The output from the command above should show the node process on port 8142 bound to and NOT to

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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