通过本地网络为iPhone提供虚拟主机 [英] make virtual host available through local network for iphone

查看:129
本文介绍了通过本地网络为iPhone提供虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用虚拟主机(mynewsite.com)在本地主机上构建一个站点.与其将文件上传到实际的服务器,我宁愿只在本地进行测试.我的桌面上有虚拟主机,我只是希望它可以使用,以便可以在iPhone或网络上的任何计算机上看到它.因此,如果我在iPhone上转到mynewsite.com,它将显示来自本地主机的站点.我想我需要进行端口转发,但是很难弄清楚.我在装有MAMP的Mac上.

I'm building a site on my localhost with a virtual host (mynewsite.com). Instead of uploading files to an actual server and I'd prefer to just test locally. I have the virtual host working on my desktop, I just want it to be available so I can see it on my iPhone or any computer on my network. So if I go to mynewsite.com on my iPhone it will display the site from my localhost. I think I need to do port forwarding but I'm having difficulty figuring it out. I'm on a Mac with MAMP.

如何通过我的Linksys路由器使虚拟主机可用于我的iPhone进行测试?

How do I make the virtual host available to my iPhone through my Linksys router for testing?

我在MAMP中的httpd.conf看起来像:

My httpd.conf in MAMP looks like:

<VirtualHost *:80>
    DocumentRoot "/Users/jaysonp/Sites/mynewsite"
    ServerName "mynewsite.com"
    ServerAlias *.mynewsite.com
...

然后在我的主机文件中,我有: 127.0.0.1 mynewsite.com

Then in my host file I have: 127.0.0.1 mynewsite.com

我应该注意,我不能仅点击iPhone上的ipaddress,而是有一些代码会检查域名以使网站正常工作.

I should note that I can't just hit the ipaddress on my iPhone, there is code that checks against the domain name for the site to work.

谢谢!

推荐答案

请在此处查看我的回答.但基本上,您只需要修改iPad中的Wifi设置,即可将开发计算机的IP地址用作HTTP代理.

Please see my answer here. But basically, you just have to modify the Wifi settings in your iPad to use the IP address of your development machine as an HTTP proxy.

这篇关于通过本地网络为iPhone提供虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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