[英]Node.js script loading not loading from browser (outsider) but loading from command (localhost)
I have successfully installed Node.JS and Balloons.IO chatroom on my linux based vps (with SSH). 我已经在基于Linux的vps(使用SSH)上成功安装了Node.JS和Balloons.IO聊天室。 When typing
curl http://mydomain.com:9191/
in the ssh command I can see the html is loaded. 在ssh命令中键入
curl http://mydomain.com:9191/
,我可以看到html已加载。 But, when trying to reach the same page from my browser it takes some time loading then says page could not be reached. 但是,当尝试从我的浏览器访问同一页面时,加载会花费一些时间,然后提示无法访问该页面。 Any idea why ?
知道为什么吗?
sudo netstat -anp | grep :9191
You should see your app listening to 0.0.0.0:9191
or your.ip.address.here:9191
if you see something like 127.0.0.1:9191
, then it is only listening locally so you won't be able to reach it. 如果看到
127.0.0.1:9191
,则应该看到您的应用程序正在监听0.0.0.0:9191
或your.ip.address.here:9191
,那么该应用程序仅在本地监听,因此您无法访问它。
iptables
you can check with: iptables
,则可以使用以下方法进行检查: sudo iptables --list
This will print the rules for your firewall and you can check if you port is blocked (or allowed). 这将为您的防火墙打印规则,您可以检查端口是否被阻止(或允许)。
curl
, you did this step already but for other landing here you can do something like: curl
在本地尝试,您已经完成了此步骤,但是对于其他着陆,您可以执行以下操作: curl http://localhost:9191/
and see what you get back 看看你得到了什么
curl -v http://mydomain.com:9191/
This will show header and body output so you can see if the remote host even responds; 这将显示标题和正文输出,因此您可以查看远程主机是否响应。 if it doesn't then check if the raw port is even accessable with telnet:
如果没有,则检查原始端口是否甚至可以通过telnet访问:
telnet mydomain.com 9191
which if successful will print something like: 如果成功,将打印如下内容:
Trying your.ip.address.here...
Connected to mydomain.com.
Escape character is '^]'.
If it fails it will just hang at Trying...
if it fails then your firewall is blocking the port, your host is blocking the port, or your app isn't listening to the port. 如果失败,则将挂在
Trying...
如果失败,则说明防火墙阻止了该端口,主机阻止了该端口,或者您的应用程序未侦听该端口。 If your above tests passed then contact your host because something else may be up and you should be able to get support from them. 如果您的上述测试通过了,请与您的主机联系,因为可能有其他问题,您应该能够从他们那里获得支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.