【问题标题】:403 Forbidden error on GenymotionGenymotion上的403禁止错误
【发布时间】:2016-12-24 00:42:58
【问题描述】:

我在我的 PC 上安装了 genymotion 模拟器,我想访问我的 WAMP 本地服务器并在我的 cmd 上运行 ipconfig 所以我得到了这个 IP_address 192.168.56.1 但问题是我总是收到这个错误

403 禁止 您无权访问此服务器上的 /

我尝试了question 中给出的所有答案,但没有一个能解决我的问题。

我在跑步 mysql 5.5.8, PHP 5.3.5 和 阿帕奇 2.2.17

请问有谁知道我该如何解决这个错误?

@KANAYOAUSTINKANE。这是我的代码或子域

<Virtualhost *:80>
    DocumentRoot "C:/wamp/www/mobile"
    ServerName localhost
    ServerAlias m.local host
</Virtualhost>

请帮帮我,我一直很不安

【问题讨论】:

  • 你能在浏览器中查看那个 url,在 genymotion 之外吗?
  • 没有所有浏览器仍然给我同样的错误。 Chrome、Firefox、Opera
  • 您在尝试移动网站吗?如果是,那么您是否为您的移动网站创建了任何虚拟主机或子域,或者您仍然使用localhost 如果您确实创建了虚拟主机,那么我很乐意看到您的虚拟主机的 httpd-vhost.conf 文件,因为我认为我找到了你的答案
  • 是的,我做到了。我将编辑我的问题以显示我的代码
  • @TheKingis 那么问题是 wamp 设置,与 genymotion 无关

标签: php wamp genymotion


【解决方案1】:

好的,这是一个解决方案。

第一步

更改虚拟主机的位置,并在末尾添加/,如下所示

DocumentRoot "C:/wamp/www/mobile/"

第二步

转到位于C:/camp/bin/apache/Apache2.2.17/conf/httpd.confhttpd.conf 文件,转到具有Listen 80 的行并将其更改为Listen *:80 这将使其能够监听任何IP 地址

终于

您转到httpd.conf 文件的末尾并添加此

# Tells Apache to identify which site by name
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
    ServerName localhost
    DocumentRoot "C:/wamp/www"
</VirtualHost> 
# Tells Apache to serve your mobile pages to "m.localhost"
<VirtualHost 127.0.0.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
    DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
    Allow from all
    Order Allow,Deny
    AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
    DirectoryIndex index.html index.php
</VirtualHost> 
#Here you duplicate the code for your mobile site to also accept your IP address which is 192.168.56.1
<VirtualHost 192.168.56.1>
# The name to respond to ServerName m.localhost
# Folder where the file is located which in your case is
    DocumentRoot "C:/wamp/www/mobile/"
<Directory "C:/wamp/www/mobile/">
    Allow from all
    Order Allow,Deny
    AllowOverride All
</Directory>
# Apache will look for these files, in this order, if no file is specified in the URL, but you can add more files apart from the two I listed depending on what you are having
    DirectoryIndex index.html index.php
</VirtualHost>

经过测试和工作。请不要忘记标记答案

【讨论】:

  • 非常感谢。您的回答很棒而且很完美,它完美地解决了我的问题。 :)
猜你喜欢
  • 1970-01-01
  • 2023-03-21
  • 1970-01-01
  • 1970-01-01
  • 2016-06-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多