为什么 http://localhost:8080 可用而 127.0.0.1 不可用? (MyEclipse+Tomcat 上的 JSP)
系统的主机文件很好,127.0.0.1 localhost
就在那里...
Ping 127.0.0.1,或者我的IP,结果也可以..
Myeclipse的版本是8.0,我只是使用其中的Tomcat。
一个简单的JSP+Javabean Web项目so
就部署完成了。
现在的情况是当我打开MyEclipse并启动Tomcat时,我可以通过访问我的网站 http://localhost:8080/so/index.jsp
,并且显示并运行良好(这意味着8080端口没问题,对吧?)。但是http://127.0.0.0。 0.1:8080/so/index.jsp
在K-Meleon中是一个空白页面(无源代码),在IE中找不到该页面。
尽管如此,当我尝试从局域网中的另一台电脑访问它时,'http://myIP:8080/so/ index.jsp',它只起作用了一点。浏览器可以加载主页,但没有CSS,点击任何链接甚至刷新页面都会导致错误页面。(虽然该网站在我自己的电脑上通过本地主机访问运行得很好)
有没有人遇到过这种情况?
The System's hosts file is fine, 127.0.0.1 localhost
is there...
Ping 127.0.0.1,or my IP, the result is also fine..
Myeclipse's version is 8.0 and I'm just using the Tomcat within it.
A simple JSP+Javabean web project so
is deployed.
Now the situation is when I open MyEclipse and start the Tomcat, I can access my site throuthhttp://localhost:8080/so/index.jsp
, and it displays and runs well (this means 8080 port is all right,right?).But http://127.0.0.1:8080/so/index.jsp
is a blank page(no source code) in K-Meleon and the page can't be found in IE.
Still when I tried to access it from another pc in LAN, 'http://myIP:8080/so/index.jsp', it worked only a little. The browser can load the homepage but without CSS, and clicking on any link or even refreshing the page leads to an error page..(While the site gose quite well on my own pc accessed throught localhost)
Is there anyone have ever met this situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您将 tomcat 配置为仅侦听非环回接口,这就是您会得到的结果。
请参阅此说明,了解如何在 server.xml 中进行配置。
使用
netstat -a
查看您的 tomcat 实际监听的内容。If you configured tomcat to only listen on the non-loopback interface, this is what you'd get.
See this description of how this gets configured in server.xml.
Use the
netstat -a
to see what your tomcat is actually listening on.