端口转发正确但无法访问局域网外的Tomcat [英] Port is forwarded correctly but can't access Tomcat outside LAN
问题描述
我的 Tomcat 有问题.
I have an issue with my Tomcat.
我想做什么:
我希望能够在局域网外访问我的 web 应用程序.我使用 Tomcat 作为网络服务器,监听 9191 端口.
I want to be able to access my webapp OUTSIDE my LAN. I'm using Tomcat as webserver, listening to port 9191.
托管 Tomcat 的机器具有静态 IP(例如 192.168.1.100).我的网络配置如下:
The machine that is hosting Tomcat has STATIC IP (e.g 192.168.1.100). My network configuration is as following:
互联网 ----- 我的路由器 ----- 计算机 1----- 计算机 2 (静态 IP: 192.168.1.XXX) - 托管 TOMCAT
INTERNET ----- MY ROUTER ----- COMPUTER 1 ----- COMPUTER 2 (STATIC IP: 192.168.1.XXX) - HOSTING TOMCAT
我已经使用 PFPortChecker 工具测试了端口转发,它说一切正常,端口转发正确.
I've already tested the port forwarding with the PFPortChecker tool and it says that everything is working fine and the port is forwarded correctly.
问题:
当我尝试 http://localhost:9191/myAppName 或 http://192.168.1.XXX/myAppName 时,即使我尝试从同一局域网中的另一台计算机..但是,如果我尝试 http://mypublicip:9191/myAppName.浏览器说它无法打开网站.我对此感到绝望.我不知道我还能做什么.
When I try http:// localhost:9191/myAppName or http:// 192.168.1.XXX/myAppName, it works, even if I try from another computer in the SAME LAN. . However, if I try http:// mypublicip:9191/myAppName. The browser says that it can't open the website. I'm desperate about this. I don't know what could I do anymore.
Tomcat 配置:
server.xml:http://pastebin.com/vhnuEHBM
server.xml: http://pastebin.com/vhnuEHBM
那么,我能做什么?
推荐答案
您已将 tomcat 绑定到环回接口.将其设置为 0.0.0.0(以侦听所有接口)或您分配给计算机的静态 IP.
You have tomcat bound to the loopback interface. Either set it to 0.0.0.0 (to listen on all interfaces) or the static ip you've assigned to your computer.
这篇关于端口转发正确但无法访问局域网外的Tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!