【发布时间】:2016-05-17 19:36:36
【问题描述】:
我已将我的应用部署到 ununtu。
这是垃圾箱/www:
app.set('port', 3000);
app.set('host','app.site.com');
var server = http.createServer(app);
server.listen(port,'64.143.255.122');//I put here a fake IP (deployed with the real one)
server.on('error', onError);
server.on('listening', onListening);
我在我的 PC 中创建了一个主机:64.143.255.122 app.site.com,然后我打开浏览器:http://app.site.com:3000,但它不起作用。
但是,如果我通过lynx,在服务器内部写入lynx http://localhost:3000,它会起作用,我会得到正确的页面。
可能是什么问题?
谢谢
【问题讨论】:
-
您是否尝试在不指定 ip 的情况下侦听端口?以便它在本地主机上侦听?并在 sever.listen 线上使用 3000 而不是端口?只是为了调试?
-
@rmjoia - 是的,一模一样
-
它会抛出任何错误吗?在您的错误事件处理程序上?你可能确实找到了这个,但是......我认为帖子提到了端口绑定和所有,stackoverflow.com/questions/18008620/…
-
nslookup app.site.com显示的 IP 地址是什么?