If in macOS Catalina, using the default install of Apache, if I run sudo apachectl start followed by pgrep httpd it will show multiple occurrences of httpd, sometimes just two and other times four occurrences. I actually never noticed it because on my system httpd doesn't show up in Activity Monitor and why I used pgrep httpd from Terminal. MacOS 10.13 High Sierra and 10.14 Mojave come with Apache pre-installed. However, instead of using the delivered version we’re going to install Apache via Homebrew and then configure it to run. Option 1: Drag Apache icon to the Trash. Open up the Finder, click Applications on the left side, and then select Apache. Drag Apache to the Trash (or right click on it and then select Move to Trash option). Right click the Trash icon and select Empty Trash option to start the uninstall. This drag-to-delete method works in all versions of Mac OS X. Install and configure Apache. MacOS 10.15 Catalina comes with Apache pre-installed. However, instead of using the delivered version, we’re going to install Apache via Homebrew and then configure it to run on port 80. If you already have the pre-installed Apache running, it will need to be shut down first and any auto-loading scripts removed.
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
Install Apache, MySQL, PHP on macOS 11 Big Sur and Reset Forgotten Admin Password on macOS Big Sur and Installing node.js on macOS Big Sur and earlier Enable the root user in macOS Big Sur and earlier Where is the bash shell in macos Big Sur and Catalina? How to Add to the Shell Path in macOS Big Sur.
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:
System Preferences
=> Security & Privacy
=> Full Disk Access
httpd
.That worked for me.
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.
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…
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
Step 4: open Web browsers type localhost
Step5: Done
When we use web server as apache2 very often we need mod_rewrite rules to be enabled. In case of linux kernel based OS enabling the mod_rewrite is easy. A single command can enable it. For Mac OS it is bit different.
To enable mod_rewrite on Mac we need to the followings:
This should enable the mod_rewrite for apache2
If you try using a2enmod to enable the mod_rewrite rules in Mac will not work as a2enmod was written for the Debian distribution, as it is a Debian-specific.