Meteor - accessing the app using public ip

前端 未结 2 1915
别那么骄傲
别那么骄傲 2021-01-13 18:19

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.

I am all

相关标签:
2条回答
  • 2021-01-13 18:42

    Your service is probably only running locally (on local ports, 127.0.0.0/8), To confirm this, run netstat -tulpn to see what services are running and on what ports/interfaces. If you don't see 0.0.0.0:3000 or 128.84.125.239:3000 then you won't be able to get ti it from the IP you are trying and you need to change the bind address of your app to be that IP (or all interaces).

    0 讨论(0)
  • 2021-01-13 18:57

    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.

    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.

    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.

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

    0 讨论(0)
提交回复
热议问题