我很难找到一种方法在我的Android手机上访问虚拟主机的页面(以及默认的Apache index.html页面)。我的Android和PC上的hosts文件都使用127.0.0.1作为localhost和domain1.com。我在我的PC上重启了我的Apache服务器,在我PC的浏览器domain1.com上可以很好地访问它,但我似乎无法在Android浏览器上访问它。我已经尝试了一个公共IP地址,domain1.com,domain1.com:8000,127.0.0.1:8000,localhost:8000...但似乎没有一个管用。不过,它们可以在我本地的PC上运行。这是我的httpd.conf文件:
<Directory /home/*/public_html/>
AllowOverride FileInfo AuthConfig Limit
Order allow,deny
Allow from all
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
ScriptAlias /cgi-bin/ "/home/*/public_html/domain1.com/public/"
Listen 8000
NameVirtualHost *:8000
<VirtualHost *:8000>
ServerName domain1.com
DocumentRoot /home/*/public_html/domain1.com/public
</VirtualHost>发布于 2012-02-12 06:45:07
电话上的localhost (也称为127.0.0.1)指向您的电话。PC上的localhost指向您的PC。你的电脑不是你的手机。你的手机不是你的电脑。
如果你想让手机的网络浏览器访问你的电脑,在网址中使用你电脑的IP地址,以及你想要的端口号(显然是8000)。您的PC的IP地址不是localhost。
https://stackoverflow.com/questions/9244541
复制相似问题