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