在虚拟机1上,我有一个非常简单的节点脚本
// server.js
var express = require('express');
var annotations = require('./routes/annotations');
var cors = require('cors');
var app = express();
app.use(cors());
app.options('/annotations/:id', cors());
app.get('/annotations/:id', annotations.findById);
app.listen(80, function() {
console.log('Server running');
});
当我使用浏览器访问或从本地计算机http://example.com/annotations/5770dffb2dc30a7433c729f7进行卷曲时,我立即获得正确的数据。
但是当我从虚拟机2尝试使用PHP脚本(file_get_contents或curl),使用CURL或甚至使用w3m时,我无法访问它。 W3m说,PHP和CURL正在尝试很长时间然后最终进入超时状态。
Can't load http://example.com/annotations/5770dffb2dc30a7433c729f7.
我失去了理智!有什么建议吗?
答案 0 :(得分:0)
我认为问题是网络,而不是节点。请检查您是否可以
ping 10.55.55.111
假设第一个VM的IP地址运行节点是10.55.55.111,则从第二个虚拟机。如果失败,则表示存在网络问题。
两种可能的解决方案: