流星-使用公共​​IP访问应用 [英] Meteor - accessing the app using public ip

查看:116
本文介绍了流星-使用公共​​IP访问应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用localhost:3000访问该应用程序,但是我试图从本地移动设备进行测试,而不必进行部署.但是我无法访问该网站.

I can access the app using localhost:3000 but I am trying to test from mobile devices locally, without having to deploy it. But I couldn't access the site.

我允许传入请求:

sudo ufw status verbose
Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing)
New profiles: skip

To                         Action      From
--                         ------      ----
3000/tcp                   ALLOW IN    Anywhere
3000/tcp                   ALLOW IN    Anywhere (v6)

我发现我的IP地址是128.84.125.239,所以我访问了128.84.125.239:3000,却什么也没发生.

I found that my ip address is 128.84.125.239 and so I visit 128.84.125.239:3000 and nothing happens.

推荐答案

事实证明,这是使用正确的IP或正确配置路由器NAT的问题.使用cmyip.com之类的服务只会为您提供外部IP地址.仅在路由器配置正确的情况下,此地址才能到达流星应用程序,即路由器会将端口3000(或运行应用程序的端口)上的请求转发到服务器.

This turned out to be an issue of using the right IP, or configuring the NAT of the router appropriately. Using a service such as cmyip.com will only provide you with your external IP address. This address can only reach your meteor app if your router is configured accordingly, i.e., the router will forward requests on port 3000 (or whichever port you are running your app on) to your server.

要在开发期间在移动设备上进行测试,最好使用内部IP地址,前提是您的移动设备与应用程序服务计算机位于同一网络上.

For testing on a mobile device during development you are most likely best off using your internal IP address, assuming your mobile device is on the same network as your app-serving machine.

在Linux上,您可以使用ifconfig来获取内部IP.如果通过以太网连接,则将查找设备eth0(在大多数情况下).如果您通过wifi连接,则您要查找的设备通常称为wlan0.

On Linux you can use ifconfig to get your internal IPs. If you are connected via ethernet then you'll be looking for the device eth0 (in most cases). If you are connected over wifi, then the device you are looking for is typically called wlan0.

在Mac OSX上,您也可以使用ifconfig,并查找称为enX的设备,其中X是数字(通常为0或2).

On Mac OSX you can use ifconfig as well, and look for devices called enX, where X is a number (often 0, or 2).

这篇关于流星-使用公共​​IP访问应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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