您如何从 iPhone 浏览器访问在本地主机上运行的网站 [英] How do you access a website running on localhost from iPhone browser

查看:29
本文介绍了您如何从 iPhone 浏览器访问在本地主机上运行的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个移动网站,并想使用我的 iPhone 浏览器对其进行测试.我的 Windows 7 机器和 iPhone 在同一个无线网络上.如何从 iPhone 访问本地主机?现在我收到 404 错误.

I am working on a mobile website and would like to test it using my iPhone browser. My Windows 7 machine and iPhone are on the same wireless network. How do I access localhost from the iPhone? Right now I get a 404 error.

推荐答案

从 iPhone 访问 localhost 只会做一个环回/尝试连接到它自己(如果它支持?).

Accessing localhost from the iPhone will simply do a loopback / try to connect to itself (If it supports that?).

您需要做的是找到台式机的 IP(例如,如果是 Windows,请转到 Command Prompt 并键入 ipconfig 或转到 Network和共享中心并查找连接状态.

What you need to do is find the IP of your desktop machine (e.g. If Windows, go to the Command Prompt and type ipconfig or go to Network and Sharing Centre and look up connection status.

获得 IP 后,只需从浏览器访问该 IP,例如http://192.168.0.102.

Once you have your ip, simply visit that from your browser e.g. http://192.168.0.102.

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

You may need to open up port 80 (or whatever port your website is running on) in the inbound security of your firewall if you are running one.

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

Note: don't forget the app's port if what you want is to debug the app in your iPhone's browser like: http://192.168.0.102:3000. In this example 3000 is the default port used by ReactJS.

这篇关于您如何从 iPhone 浏览器访问在本地主机上运行的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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