XAMPP 5.5.38 virtualhost 403禁止访问

时间:2018-08-19 12:12:18

标签: apache xampp virtualhost

我将Mac OSX 10.7.5与运行Apache 2.4的XAMPP 5.5.38一起使用

当我在地址栏中输入localhost或在etc / hosts文件中配置的任何其他名称时,此消息出现:

Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

这是httpd-vhosts.conf

<VirtualHost *:80>
    # get the server name from the 'host:' header
    UseCanonicalName Off
    ErrorLog "logs/myname-error_log"
    DocumentRoot "/Applications/XAMPP/xamppfiles/sites/%0/public_html"
    <Directory /Applications/XAMPP/xamppfiles/sites/%0/public_html>
        DirectoryIndex index.html index.html.var index.php index.php3 index.php4
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName localhost
</VirtualHost>

这些是权限:

drwxrwxr-x /Applications/XAMPP/xamppfiles/sites
drwxrwxr-x /Applications/XAMPP/xamppfiles/sites/%0
drwxrwxr-x /Applications/XAMPP/xamppfiles/sites/%0/public_html
-rw-rw-r-- /Applications/XAMPP/xamppfiles/sites/%0/public_html/index.php

但是,当我更改虚拟主机的顺序时,localhost(在htdocs中)正在运行,并且其他任何站点名称都重定向到localhost。

<VirtualHost *:80>
   DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
   ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    # get the server name from the 'host:' header
    UseCanonicalName Off
    ErrorLog "logs/myname-error_log"
    DocumentRoot "/Applications/XAMPP/xamppfiles/sites/%0/public_html"
    <Directory /Applications/XAMPP/xamppfiles/sites/%0/public_html>
        DirectoryIndex index.html index.html.var index.php index.php3 index.php4
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

有人可以帮我解决这个问题吗? 谢谢

0 个答案:

没有答案