从外部机器访问Jetty服务器 [英] Accessing a Jetty server from an external machine

查看:137
本文介绍了从外部机器访问Jetty服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用本教程制作了一个简单的Jetty服务器, http://www .seas.upenn.edu/〜cis550/jetty.html

I have made a simple Jetty server using this tutorial here, http://www.seas.upenn.edu/~cis550/jetty.html

现在我已经完成了初始步骤,通过在浏览器中输入localhost:8080/hello或127.0.0.1:8080/hello,可以成功连接到服务器.到现在为止,一切都进展顺利. servlet正常工作.

Now that I have the initial steps completed, I can succesfully connect to my server by entering localhost:8080/hello or 127.0.0.1:8080/hello in my browser. Everything is going great up until this point. The servlet is working properly.

我现在对使用计算机B"连接到服务器感兴趣.我想构建一个可以通过任何地方的任何浏览器连接的服务器.

I am now interested in connecting to the server using "Machine B". I want to build a server that can be connected by any browser, anywhere.

我的IP为XX.173.XXX.216,出于明显的隐私原因,这些部分被隐藏了.在我的机器B"上,尝试在浏览器URL中输入XX.173.XXX.216:8080/hello.找不到该网站.根据经验,我对端口映射提出了质疑,并打开了8080端口.

My IP is XX.173.XXX.216, parts hidden for obvious privacy reasons. On my "Machine B" I try and enter XX.173.XXX.216:8080/hello into the browser URL. The website cannot be found. From experience I questioned my port mapping and opened my 8080 port.

经过几次Google搜索和一段时间的阅读后,我放弃了.有人知道我的问题可能的解决方案吗?在设置Jetty服务器时,是否需要采取其他步骤以使其可从外部计算机访问?

After a few google searches and a while of reading, I give up. Does anyone know a possible solution to my problem? Are there any further steps I need to do in the setup of the Jetty server to make it accessible from external machines?

推荐答案

通常不难从防火墙的内部 out 中获取.从外部和内部进行获取都比较麻烦(只需看看Skype跳过的铁环,就能将两台计算机分别放在防火墙后面即可直接进行对话).

It is usually not hard getting from the inside of a firewall and out. It is much trickier to get from the outside and in (just have a look at the hoops Skype jumps through to be able to get two computers each behind a firewall to talk to each other directly).

首先,您需要确保Jetty侦听正确的网络设备.

First of all you need to ensure that Jetty listens to the right network devices.

标识运行Jetty的计算机的IP地址(不是127.0.0.1),并查看是否可以从计算机本身连接到"http://that-ip-number:8080".如果这不起作用,请修复您的码头配置.然后将另一台计算机放在同一网络上,并也连接到"http://that-ip-number:8080".在继续之前,此功能必须起作用.如果这不起作用,请在运行Jetty的计算机上修复防火墙配置.

Identify the IP-number of the computer running Jetty (not 127.0.0.1) and see if you can connect to "http://that-ip-number:8080" from the machine itself. If this doesn't work, fix your jetty configuration. Then put another computer on the same network and connect to "http://that-ip-number:8080" too. This MUST work before you go any further. If this doesn't work, fix your firewall configuration on the computer running Jetty.

当上述方法起作用时,您就可以开始考虑通过路由器公开端口了.路由器很可能具有可在其中进行配置的Web界面,但是最简单的方法是使用uPNP工具(如果您的路由器支持),该工具可以将外部端口重定向到内部网络上的特定主机和端口.我在OS X下使用端口映射",它的界面非常简单.

When the above works,then you can start thinking about exposing the port through your router. The router most likely has a web interface where you can configure this, but the easiest way to do that is to use a uPNP tool (if your router supports that) which can redirect an external port to a specific host and port on your internal network. I use "Port Map" under OS X which has a very simple interface.

祝你好运

这篇关于从外部机器访问Jetty服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆