MacOS XAMPP 访问禁止错误 403 - 您无权访问请求的目录

dan*_*oll 6 php apache xampp macos virtualhost

我有一些 PHP Web 应用程序在 macOS 10.15 上运行 XAMPP 7.4.1。XAMPP 过去曾为我工作过。我的开发环境搞砸了,因为 32 位应用程序与 Catalina 混在一起,而且我的旧 XAMPP 安装无法打开。我已重新设置虚拟主机,但现在当我尝试访问我的网站之一时,出现以下错误。

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

If you think this is a server error, please contact the webmaster.

Error 403
Run Code Online (Sandbox Code Playgroud)

我的虚拟主机如下所示:

# localhost
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    <Directory "/Applications/XAMPP/xamppfiles/htdocs">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

#####################
# PERSONAL PROJECTS #
#####################

# Dunsparce.net
<VirtualHost *:80>
    ServerName dunsparce.net
    DocumentRoot "/Users/danielschnoll/Documents/Projects/Dunsparce.net"
    <Directory "/Users/danielschnoll/Documents/Projects/Dunsparce.net">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/dunsparce-error_log"
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我列出了更多虚拟主机,它们都遵循相同的格式。每一件我都有Require all granted,还有Allow Override AllOptions...线。就像我在文章开头所说的那样,它们过去都工作过。# Include我的文件中也有未注释的内容httpd.conf,但我很确定 Access Forbidden 错误与它完全无关。

有任何想法吗?

dan*_*oll 32

我最终不得不httpd.conf再次编辑。其中\xe2\x80\x99s 是组权限的部分User。默认情况下它说

\n\n
User daemon\nGroup daemon\n
Run Code Online (Sandbox Code Playgroud)\n\n

User将from更改daemon为您的 macOS 用户名。对我来说,我的User小组现在看起来像

\n\n
User danielschnoll\nGroup daemon\n
Run Code Online (Sandbox Code Playgroud)\n