Apache在MacOS Catalina上拒绝访问 [英] Apache gives Access denied on macOS Catalina

查看:131
本文介绍了Apache在MacOS Catalina上拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Macbook上运行了Apache Web服务器(Apple提供的服务器),并且该服务器运行得很好,直到我升级到Catalina 10.15.我使用了相同的httpd.conf,但现在它显示

您无权访问此资源.服务器无法读取htaccess文件,拒绝安全访问

我认为这是Catalina的文件夹访问权限,但是我不知道如何让Apache访问Web根文件夹(位于我的/Users/me/Documents文件夹内),因为Apache不是正常的/Application./p>

当我使用lsof -nP -i4TCP:80检查端口80是开放的时|grep LISTEN op nmap,所以Apache确实可以启动.

我在根文件夹中设置了一个简单的index.html,但是问题仍然存在.当我从Apache根文件夹中删除.htaccess时,我得到:

您无权访问此资源.

此外,尝试使用ErrorDocument处理请求时遇到403禁止错误.

这里可能是什么问题?

解决方案

我自己找到了解决方案.

这是一个 Catalina 问题:

  1. 转到系统偏好设置 =>安全性和隐私 =>全盘访问
  2. 点击"+"按钮添加一个应用程序,然后转到磁盘的根文件夹,然后按Cmd + Shift +.(点)
  3. 转到/usr/sbin/并选择 httpd .

对我有用.

I have Apache webserver (the one supplied by Apple) running on my Macbook and it ran flawlessly, until I upgraded to Catalina 10.15. I used the same httpd.conf, but now it is displaying

You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe

I thought is was folder access by Catalina, but I don't know how to let Apache access the web root folder (which is inside my /Users/me/Documents folder)as Apache is not a normal /Application.

Port 80 is open when I check with lsof -nP -i4TCP:80 | grep LISTEN op nmap, so Apache does start.

I set a simple index.html in the root folder, but the problem persists. And when I remove the .htaccess from the Apache root folder I get:

You don't have permission to access this resource.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

What can be the problem here ?

解决方案

I have found the solution, myself.

It is a Catalina issue:

  1. Go to System Preferences => Security & Privacy => Full Disk Access
  2. Click on the "+" button to add an app and go to the root folder of the disk and press Cmd + Shift + .(dot)
  3. Go to /usr/sbin/ and select httpd.

That worked for me.

这篇关于Apache在MacOS Catalina上拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆