0
我试图逃离作为本地测试服务器,我很难从托管Windows机器连接到nodejs应用服务器,但我可以连接到nginx服务器就好了。无法连接到托管在流浪机上的节点js服务器
我的无业游民文件:
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
我的节点JS从app_0 index.js(的HelloWorld)在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);
});
其上运行使用sudo节点index.js和可见本地在流浪机上,但我无法连接到它从主机55.55.55.1:80
请不要标记这个副本:Connect to node js server running on vagrant machine,因为它不使用端口转发。
咦,有一件事我不明白的是,55.55.55.1后仍然笔者从断开没有工作我网络。我尝试了10.0.0.10并像魅力一样工作。谢谢! – legokangpalla