代码之家  ›  专栏  ›  技术社区  ›  151291

Windows server 2012:禁止对xampp项目进行访问

  •  2
  • 151291  · 技术社区  · 6 年前

    使用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 回复  |  直到 6 年前
        1
  •  0
  •   Paul Shipley    6 年前

    我发现这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
    

    希望这有帮助。