【问题标题】:Wamp : You don't have permission to access file.html on this serverWamp:您无权访问此服务器上的 file.html
【发布时间】:2015-12-01 19:48:52
【问题描述】:

我尝试创建一个虚拟主机来使用 wampserver 访问我的本地网站,但是当我尝试访问该网页时,我得到了 403 Forbidden

我在浏览器中输入以下代码:

mywebsite/html/start.html

这是我的 httpd-vhost 文件的内容:

<VirtualHost *:80>
    ServerName mywebsite
    DocumentRoot "D:\pathToMySite"
    <Directory "D:\pathToMySite">
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

我也把别名放在我的主机文件中:

127.0.0.1    mywebsite

【问题讨论】:

  • 路径中缺少斜杠
  • @PeeHaa 这是一个糟糕的复制/粘贴,我修复了它
  • 斜杠也应该是正斜杠(linux/unix方式)

标签: php apache


【解决方案1】:

我会在windows下分享我的AMPPS的httpd.conf(应该和wamp很相似)

<VirtualHost 127.0.0.1:80>
    <Directory "{$path}/www">
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        allow from All
    </Directory>
    ServerName localhost
    ServerAlias localhost 127.0.0.1
    ScriptAlias /cgi-bin/ "{$path}/www/cgi-bin/"
    DocumentRoot "{$path}/www"
    ErrorLog "{$path}/apache/logs/error.log"
    CustomLog "{$path}/apache/logs/access.log" combined
</VirtualHost>

<VirtualHost *:80>
    <Directory "F:/www">
        Options FollowSymLinks Indexes
        AllowOverride All
        Order deny,allow
        allow from All
    </Directory>
    DocumentRoot "F:/www"
    ServerName site1.com
</VirtualHost>

我也将主机文件用于本地 DNS

127.0.0.1    site1.com

希望有帮助!

【讨论】:

    猜你喜欢
    • 2015-12-24
    • 2016-09-11
    • 2013-10-23
    • 1970-01-01
    • 2012-05-22
    • 2012-09-12
    • 2012-01-12
    相关资源
    最近更新 更多