Apache gives Access denied on macOS Catalina

php and js picture php and js · Oct 18, 2019 · Viewed 8.1k times · Source

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 ?

Answer

php and js picture php and js · Oct 18, 2019

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.