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

2022-01-14 00:00:00 macos xampp php apache virtualhost

我有一些 PHP Web 应用程序在 macOS 10.15 上运行 XAMPP 7.4.1.XAMPP 过去曾为我工作过.我把我的开发环境搞砸了,因为 32 位应用程序在 Catalina 的基础上搞砸了,而且我的旧 XAMPP 安装没有打开.我恢复了我的 VirtualHosts 设置,但现在当我尝试访问我的一个网站时,我收到以下错误.

I have some PHP web apps running off XAMPP 7.4.1 on macOS 10.15. XAMPP has worked for me in the past. I got my dev environment screwed up because 32 bit apps sh*t the bed with Catalina, and my old XAMPP installation didn't open. I got my VirtualHosts set back up, but now when I try to access one of my sites I get the following error.

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

我的虚拟主机如下所示:

My virtual hosts look like the following:

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

我列出了更多虚拟主机,它们都遵循相同的格式.我在每一个上都有 Require all grant 以及 Allow Override AllOptions... 行.就像我在帖子开头所说的那样,他们过去都工作过.我的 httpd.conf 文件中也有 # Include 未注释,尽管我很确定 Access Forbidden 错误与它完全无关.

I have more VirtualHosts listed and they all follow the same format. I have Require all granted on each one, as well as the Allow Override All and the Options... line. Like I said at the start of the post, they all worked in the past. I also have the # Include uncommented in my httpd.conf file, though I'm pretty sure Access Forbidden error is completely unrelated to it.

有什么想法吗?

推荐答案

我不得不再次编辑 httpd.conf.User 组权限有一个部分.默认情况下它说

I wound up having to edit httpd.conf again. There’s a section for User group permissions. By default it says

User daemon
Group daemon

Userdaemon 更改为您的 macOS 用户名.对我来说,我的 User 组现在看起来像

Change the User from daemon to your macOS Username. For me, my User group now looks like

User danielschnoll
Group daemon

相关文章