简体   繁体   English

为什么servername:port不起作用为什么node.js中的localhost:port起作用?

[英]why servername:port does not work why localhost:port in node.js works?


I am node newbie. 我是节点新手。 I have a windows server, where I am running node.js with webserver.js . 我有一台Windows服务器,在其中运行带有webserver.js的 node.js。 Start the node with webserver.js. 使用webserver.js启动节点。 Fireup the IE and when I tried localhost:port/index.html, the page shows properly in the IE. 启动IE,当我尝试localhost:port / index.html时,该页面会在IE中正确显示。 Now if I change the localhost to servername:port/index.html, IE is unable to display the page ('IE cannot display the webpage with you can try diagnose connection problem). 现在,如果我将localhost更改为servername:port / index.html,则IE无法显示该页面(“ IE无法与您一起显示网页,您可以尝试诊断连接问题)。 Is there anything I need to enable in node so it is available outside localhost? 我需要在节点中启用任何功能,以便它在localhost之外可用吗? I have jenkins runs on the same server, I did not do anything and it shows up properly with the server name. 我的jenkins在同一台服务器上运行,我什么也没做,它与服务器名一起正确显示。 Just curious. 只是好奇。

Thanks 谢谢

my problem was that, I used the code from the link, in the link it was use IP address, I changed it to server name, now I am able to hit the link using both server and proper url. 我的问题是,我使用了链接中的代码,在该链接中使用IP地址,将其更改为服务器名称,现在我可以使用服务器和正确的URL来访问链接。 Hope this might help others. 希望这可以帮助其他人。 I did not change to use netstat though. 我没有更改为使用netstat。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM