java - intellij IDEA 使用tomcat启动,本机ip访问不行,localhost访问可行
天蓬老师
天蓬老师 2017-04-18 09:47:45
0
3
870

使用intellijIDEA结合tomcat部署并成功运行项目,在浏览器中访问项目的页面,当url为localhost:8081/...时可用正常访问,当改用10.26.210.194(本机局域网ip)访问的时候,就加载不出了.请问诸位这个问题怎么破?(我用的是2016版本,不过听说intellijIDEA貌似一直有这个问题?)
有人说hosts可能有问题,我也贴出来给诸位看看

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
刘奇

This is not IDEA’s problem.
The process behind when you type in the URL and press Enter is very complicated. If you want to get started, you can read this article of mine
Not surprisingly, there is this sentence in your hosts:

127.0.0.1 localhost

When you enter localhost, it will first check whether the input is in the local hosts. localhost will directly return the result, because 127.0.0.1是个保留地址,系统知道这个就是自己,不会进行网络传输。而10.26.210.194 will not, and will ask the upper-level gateway where the IP is? There are at least two layers of obstacles in this process, the local firewall and the gateway firewall. For example:

  • 8081 is not exposed to the outside world

  • The gateway has disabled internal routing

......

This situation is usually caused by the first reason: the local firewall does not expose this port to the outside world by default. Of course, you can also add a record with localhost to hosts.

左手右手慢动作

Impossible

There is something wrong with your IP. Check carefully.


netstat -na | findstr port

The poster can use the above command to view the listening IP of the port and replace port with the port of his own service.

If the poster’s monitoring does not impose IP restrictions as above, then you can check the firewall,
IDEA is just an integrated development environment, and it is impossible to impose IP restrictions on started services.

左手右手慢动作

I have tried that the local IP can be accessed. There should be a problem with your computer’s hosts file

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!