When i try to open localhost it gives me 403 error message like this "You don't have permission to access / on this server."
I have tried changing the permission but nothing happens. It worked fine with High Sierra but after update its not working.I am using the pre installed apache and not using third party apps like xampp
4 Answers
I had the same problem - it's based on mod_userdir exclusion after updating to Mac OS X Mojave. There are a few steps to repair that:
- Load the module
mod_userdir
in/etc/apache2/httpd.conf
- At the end of the
httpd.conf
make sure to loadhttpd-userdir.conf
- In httpd-userdir.conf include a local file in
/etc/apache2/users/<username>.conf
Put a directory section into that file, containing the rules for the directory where your webserver files are located:
<Directory "/Users/<myusername>/Sites/"> AllowOverride All Options Indexes FollowSymLinks Require all granted </Directory>
This should set you up.
-
This worked .. however when I access localhost .. it gives me index of all the files does not load the website. Oct 2, 2018 at 14:26
-
-
-
On /etc/apache2/httpd.conf search for "#LoadModule php7_module libexec/apache2/libphp7.so". Remove "#", then restart Apache. Hope that helps... Feb 11, 2019 at 1:16
The Mojave update (or re-install) overwrites the apache directory but left my old configs with the ~previous
suffix left.
I did edit a lot of previous files in my apache path /private/etc/apache2
. These files were renamed to like httpd.conf~previous
and a new httpd.conf
has taken place.
I just renamed files, restart my apache and everything is working like before now. It wasn't every previous file, as i knew i did not edited all of them.
In my case also the /private/etc/apache2/extra/httpd-vhosts.conf~previous
had to get back in place
I had the same problem after I updated to Big Sur.
In my case the configuration files from the apache2 folder were supposedly 'incompatible with the recent macOS upgrade'.
Because of that Apple moved my httpd.conf
and httpd-vhosts.conf
to
/Users/Shared/Relocated Items
I just had to copy them over to the old location and everything worked again.
Apache The new macOS Mojave comes with Apache pre-installed. All we have to do is switch it on.
Open Terminal using macOS Spotlight or go to /Applications/Utilities and open Terminal.
To check the version of Apache installed run the following command in the Terminal.
Check that : https://www.dyclassroom.com/howto-mac/how-to-install-apache-mysql-php-on-macos-mojave-10-14
-
This definitely helped me. Please add the actual command to run in Terminal to your answer. Aug 3, 2019 at 20:25