Ensure that any user-specific configs are included!
If none of the other answers on this page for you work, here's what I ran into after hours of floundering around.
I used user-specific configurations, with Sites
specified as my UserDir
in /private/etc/apache2/extra/httpd-userdir.conf
. However, I was forbidden access to the endpoint http://localhost/~jwork/
.
I could see in /var/log/apache2/error_log
that access to /Users/jwork/Sites/
was being blocked. However, I was permitted to access the DocumentRoot, via http://localhost/
. This suggested that I didn't have rights to view the ~jwork
user. But as far as I could tell by ps aux | egrep '(apache|httpd)'
and lsof -i :80
, Apache was running for the jwork
user, so something was clearly not write with my user configuration.
Given a user named jwork
, here was my config file:
/private/etc/apache2/users/jwork.conf
<Directory "/Users/jwork/Sites/">
Require all granted
</Directory>
This config is perfectly valid. However, I found that my user config wasn't being included:
/private/etc/apache2/extra/httpd-userdir.conf
## Note how it's commented out by default.
## Just remove the comment to enable your user conf.
#Include /private/etc/apache2/users/*.conf
Note that this is the default path to the userdir conf file, but as you'll see below, it's configurable in httpd.conf
. Ensure that the following lines are enabled:
/private/etc/apache2/httpd.conf
Include /private/etc/apache2/extra/httpd-userdir.conf
# ...
LoadModule userdir_module libexec/apache2/mod_userdir.so