Question or issue on macOS:
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
If you have installed Apache, PHP, and MySQL for Mac OS Mojave, read my post on Updating Apache, PHP, and MySQL for macOS Catalina. I am aware of the web server software available for macOS, notably MAMP, as well as package managers like brew.
You don’t have permission to access this resource.Server unable to read htaccess file, denying access to be safe
If you need to setup a MySQL Workbench, you can refer to Using MySQL Workbench on macOS Catalina (2019) If you are using macOS Catalina, check out Setting Up Your Local Server on macOS Catalina (2019) – MAMP – macOS, Apache, MySQL, PHP to setup your mac local web server. Make Apache listen only to localhost. Again, in httpd.conf: Listen 80 - Listen 127.0.0.1:80 And restart Apache again: $ sudo apachectl restart Disable Apache in the application firewall (note that you may have already disabled it if you clicked Deny if/when it was asked during the first time you run Apache).
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 ?
How to solve this problem?
Solution no. 1:
I have found the solution, myself.
It is a Catalina
issue:
- Go to
System Preferences
=>Security & Privacy
=>Full Disk Access
- Click on the “+” button to add an app and go to the root folder of the disk and press
Cmd + Shift + .(dot) - Go to /usr/sbin/ and select
httpd
.
That worked for me.
Solution no. 2:
i had the same error, the problem in my case was that macOS Catalina comes with the php module disable by default, in the error log apear as:
tail /private/var/log/apache2/error_log
[Wed Feb 26 18:10:57.123036 2020] [autoindex:error] [pid 3145] [client
127.0.0.1:53734] AH01276: Cannot serve directory /Library/WebServer/Documents/subdir/: No matching DirectoryIndex
(index.html) found, and server-generated directory index forbidden by
Options directive
the apache server was loking for index.html instead of index.php so it was blocking the list directory, I uncommented the line #LoadModule php7_module libexec/apache2/libphp7.so in /etc/apache2/httpd.conf and restart the apache server
sudo apachectl restart
and it just work. hope it helps.
Solution no. 3:
The above answer save my life!
I tried all the different Apache configs possible, nothing worked.
Just a small correction for step 2 – click on the “+” sign to add an app, navigate to the root folder then press Cmd + Shift + .(dot) which will show all hidden folders and allow you to see the folder in step 3 (/usr/sbin/)
I wish Apple would have at least shown some error in such a case…
Solution no. 4:
Mac catalina apache forbidden issue
Step 1: sudo code /etc/apache2/httpd.conf
Step 2:search for line #LoadModule php7_module libexec/apache2/libphp7.so
and uncomment no need to delete it.
Step 3: sudo apachectl restart
Apache Tomcat Macos Catalina
Step 4: open Web browsers type localhost
Step5: Done