Windows Server 2012:xampp项目禁止访问

时间:2018-06-14 12:31:54

标签: php xampp windows-server-2012

使用Windows Server 2012安装的XAMPP(Apache / 2.4.33(Win32)OpenSSL / 1.0.2o PHP / 5.6.36)检查了几乎stackoverflow的答案,但得到了同样的错误。

xampp不会从xampp仪表板以外的htdocs访问任何项目。

错误:

enter image description here

httpd-vhost.conf:

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/mysite"
    ServerName local.yourdomain.com
    <Directory "C:/xampp/htdocs/mysite">
        Require all granted 
    </Directory>
</VirtualHost>

主持人:

127.0.0.1       localhost
127.0.0.1       local.yourdomain.com

httpd.conf:

DocumentRoot "C:/xampp/htdocs/mysite"
<Directory "C:/xampp/htdocs/mysite">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted

</Directory>

1 个答案:

答案 0 :(得分:0)

我发现这些403错误(几乎)总是Apache配置错误。不幸的是,日志中没有很多诊断信息。

在httpd-vhosts.conf文件中尝试:

    <VirtualHost *:80>
      ServerName example.local
      DocumentRoot "C:\Users\shipl\htdocs\example"
      <Directory "C:\Users\shipl\htdocs\example">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
      </Directory>
    </VirtualHost>

您的主人将拥有:

127.0.0.1       localhost
127.0.0.1       example.local

请注意,'example.local'和'\ htdocs \ example'必须在所有引用中保持一致。

希望这有帮助。