我正在做一个移动网站,想用我的iPhone浏览器测试一下。我的Windows 7电脑和iPhone都在同一个无线网络上。如何从iPhone访问localhost ?现在我得到一个404错误。


当前回答

找到你系统的IP地址和你运行网站的端口。

假设您的IP地址是121.300.00.250,端口是8080。

[端口号:在运行页面时看到您的web浏览器,例如:localhost:8080/…]那么端口号是8080]

现在在你的手机转到121.300.00.250:8080/..你会找到你的网站。

重要提示:您必须确保您的服务器(例如Apache Tomcat)处于启动状态

其他回答

我想从我的iphone上浏览我的Windows 8笔记本电脑上的IIS服务器托管的网站。经过一番阅读,我打开Windows防火墙,选择“允许一个应用程序或功能通过Windows防火墙”。然后向下滚动并从列表中选中“万维网服务(HTTP)”。就是这样,它起作用了。 希望这也能帮助到其他人。

试试这个:

按Windows + R 打开cmd 执行命令ipconfig(旧)ifconfig(新) 检查你的无线网卡IP 打开iPhone,导航到“http://xxx.xxx.xxx”。Xxx /"通过浏览器。 (xxx.xxx.xxx。xxx是你的IP)

注意:你必须在你的防火墙设置上设置权限,如果有的话。

For Mac users, open up the Network Utility (You can find this by typing cmd + space which will open spotlight and then in spotlight start typing Network Utility). Select Network Utility, when it's open, your IP address will be found next to the label IP Address. So basically with the IP, you can get into any open ports on your local mac e.g. if your website is running locally on localhost:3000 and your ip address is 154.31.92.0 then from your phone you can get the website simply by typing 154.31.92.0:3000 into a browser.

PS-这只适用于手机和电脑在同一个网络上

从iPhone访问localhost将简单地做一个环回/尝试连接到它自己(如果它支持?)

你需要做的是找到你的桌面机器的IP(例如,如果是Windows,进入命令提示符并输入ipconfig或进入网络和共享中心并查看连接状态。

一旦你有了你的ip,只需从你的浏览器访问,例如http://192.168.0.102。

如果您正在运行防火墙,您可能需要在防火墙的入站安全中打开端口80(或您的网站正在运行的任何端口)。

注意:如果你想调试应用程序,不要忘记应用程序的端口 你的iPhone浏览器:http://192.168.0.102:3000。在本例中,3000是ReactJS使用的默认端口。

步骤:

我假设您已经启动了web服务器(默认端口:8080上的apache tomcat)。

windows 10下:

打开你的防病毒软件,进入防火墙部分,并找到端口 ,并添加“本地TCP/IP端口:8080”允许访问 从命令提示符获取机器IP地址。(IPv4地址) 从iPhone启动chrome浏览器,转到ip地址:8080地址。

希望这能有所帮助。