简体   繁体   中英

Windows server 2012 : Access forbidden for xampp project

Checked almost stackoverflow answers but getting same error, using windows server 2012 installed XAMPP( Apache/2.4.33 (Win32) OpenSSL/1.0.2o PHP/5.6.36 ).

xampp does not access any project from htdocs other than xampp dashboard.

Error :

在此处输入图片说明

httpd-vhost.conf :

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

hosts :

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>

I have found that these 403 errors are (almost) always Apache configuration errors. Unfortunately there is not a lot of diagnostics in the logs for this.

Try this in your httpd-vhosts.conf file:

    <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>

Your hosts then would have:

127.0.0.1       localhost
127.0.0.1       example.local

Note that 'example.local' and '\\htdocs\\example' must be consistent in all the references.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM