在ihost和ipad的localhost服务器上测试网站 [英] Testing website on localhost server for iphone and ipad

查看:662
本文介绍了在ihost和ipad的localhost服务器上测试网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要做的是在我的iphone或ipad上预览我在自定义本地主机服务器(使用Mamp Pro设置)上构建的内容。 localhost位于 http:// devsite:8888 而不是 HTTP://本地主机:8888

What I'm looking to do is preview what I've built on a custom localhost server (set up with Mamp Pro) on my iphone or ipad. The localhost is under http://devsite:8888 and not http://localhost:8888.

我已经尝试过类似的发现这里。结果是能够看到文件,但它只是服务器上的文件列表而没有获取index.php-没有预览启用。我已经三次检查以确保我在根目录中也有一个正确的索引。

I've tried the instructions for something similar found here. The result was being able to see the files but it was just the list of the files on the server and not picking up index.php—no previews enabled. I've triple checked to make sure I have a proper index in the root directory as well.

添加了/etc/apache2/extra/httpd-vhosts.conf文件
https://gist.github.com/07223bf788ef1e2e1411

Added /etc/apache2/extra/httpd-vhosts.conf file https://gist.github.com/07223bf788ef1e2e1411

推荐答案

将它放在.htaccess或httpd.conf中(通常是 /etc/apache2/httpd.conf on OSX):

Put this in your .htaccess or httpd.conf (usually /etc/apache2/httpd.conf on OSX):

DirectoryIndex index.php

如果放入.htaccess,请确保httpd.conf中的某个地方(或Web服务器的任何customm配置文件)都有这个(替换 / var / www / html 与你的.htaccess文件所在的目录):

If that is put in .htaccess be sure that somewhere in httpd.conf (or whatever customm config file for the web server) you have this (replace /var/www/html with the directory where your .htaccess file is):

## These lines can go anywhere in the main config file:
AccessFileName .htaccess
<Directory "/var/www/html">
    AllowOverride All
</Directory>

此外,请确保您的 / etc / hosts 文件包括:

Also, make sure your /etc/hosts file includes:

127.0.0.1       devsite
# Or whatever your local computers IP is:
# 192.164.2.164  devsite

以便主机名能够正确解析。

so that the hostname will resolve properly.

编辑:

从评论中,您的虚拟主机可能需要额外的配置。你能在你的问题中放入 /etc/apache2/extra/httpd-vhosts.conf 文件的内容吗?

From the comments, it sounds like your virtual hosts may need additional configuration. Can you put the contents of the /etc/apache2/extra/httpd-vhosts.conf file in your question?

这篇关于在ihost和ipad的localhost服务器上测试网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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