Testing website on localhost server for iphone and ipad

我是研究僧i 提交于 2019-12-23 13:15:49

问题


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.

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.

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


回答1:


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

DirectoryIndex index.php

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>

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.


Edit:

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?



来源:https://stackoverflow.com/questions/7519814/testing-website-on-localhost-server-for-iphone-and-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!