OSX El Capitan - Apache 403 Forbidden

22,866

Solution 1

I just found out that the old .conf file is saved during the El Captain update, in this folder :

/private/etc/apache2/httpd.conf.pre-update

So i just copied the old definitions to the new one :)

Solution 2

Do the following:

  • Open Terminal
  • Run:

    cd /etc/apache2/
    sudo mv httpd.conf httpd.conf.OLD
    sudo mv httpd.conf~previous httpd.conf
    sudo apachectl restart
    

After spending 3 hours on the issue - this worked for me!

Solution 3

You can navigate to /private/etc/apache2/ and then diff httpd.conf httpd.conf.pre-update to see the differences between your old conf file and the new one that's been added.

For me there was a lot of LoadModules lines commented out, and my apache user/group had been changed back to _www

Solution 4

I am not familiar with the changes in Apache 2.4 so this one really stumped me for about 30 minutes. I just upgraded from Mavericks to El Capitan (Apache 2.2 to 2.4) and I could not load my personal Sites directory (http://localhost/~{username}. I kept getting "Forbidden". After a good bit of research I found that I needed to modify /etc/apache2/users/{username}.conf to add "Require all granted". Since I never upgraded to Yosemite (which also uses Apache 2.4) I never stumbled across this one.

I hope this info helps somebody

Solution 5

Updating the directory access control worked for me:

In this example, all requests are allowed.

2.2 configuration:

Order allow,deny Allow from all

2.4 configuration:

Require all granted

Source: http://httpd.apache.org/docs/trunk/upgrading.html (under Access control)

Note: I keep my custom settings separately under /private/etc/apache2/other/.

Share:
22,866
delphirules
Author by

delphirules

Delphi is dead but still rocks.

Updated on July 26, 2022

Comments

  • delphirules
    delphirules almost 2 years

    I just upgraded from Yosemite to El Capitan but unfortunately forgot to copy my old httpd.conf and now i need to configure all of its settings again.

    I already changed the documentroot to the previous one /users/admin/www, and also configured to release access to this folder:

    <Directory "/users/admin/www">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    

    Restarted Apache but even this way I get the 'Forbidden' error when trying to access 127.0.0.1.

    What am I'm missing here?

  • TheMadDeveloper
    TheMadDeveloper over 8 years
    While the accepted answer works and is easy to do, it doesn't specifically address the problem. Restoring the old apache configs rolls back any updates to made to the apache configuration made for El Captain... sorta like fixing a broken lamp by using a candle instead (in a hyperbolic kinda way). @jcfranco and Todd Hammer have some answers below that specifically address the permissions problem.
  • psimons
    psimons about 8 years
    If you have a brand new Mac use this as the third command: sudo mv httpd.conf.pre-update httpd.conf You really, really saved my day!
  • jpbourbon
    jpbourbon about 8 years
    Good one, saved my day. Don't forget to add this definition on your /etc/apache2/extras/httpd-vhosts.conf if you use virtualhosts ;)
  • cconolly
    cconolly over 7 years
    This answer will probably work for most people as it addresses the main problem - your httpd.conf file is now incorrect. It didn't work for me however but this great guide medium.com/@JohnFoderaro/… got to me to update my httpd.conf to a place where it now works
  • user1575778
    user1575778 over 4 years
    This worked for my 10.14.6 running on a 2017 MacBook. I'm very curious what you accomplished in those commands. It looks like you're restoring httpd.conf to a previous version, but why does this work??