macOS Sierra update made my Apache's localhost inaccessible. Well, only localhost/
is accessible. But sub-folders under localhost/<other-directory>/
are NOT.
How to fix it?
Muel
Please check /private/etc/apache2/extra/httpd-userdir.conf
file.
change
#Include /private/etc/apache2/users/*.conf
to
Include /private/etc/apache2/users/*.conf
and restart apache.
Here's the steps I followed to fix this:
Go to /private/etc/apache2 Open httpd.conf.bak, copy the contents, overwrite httpd.conf with it then save
In httpd.conf, change
Options FollowSymLinks Multiviews
to
Options FollowSymLinks Multiviews Indexes
Change
DocumentRoot "/Users/username/Sites"
<Directory "/Library/WebServer/Documents">
to
DocumentRoot "/Users/username/Sites"
<Directory "/Users/username/Sites">
Then save
Check the /users/ directory and go to your *.conf file and check it is similar to below:
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
# OSX 10.10 / Apache 2.4
Require all granted
</Directory>
Then run sudo apachectl restart
That should then work :-)
来源:https://stackoverflow.com/questions/39631351/apache-localhost-403-forbidden-with-macos-sierra