0

I'm in the process of setting up my local ~/Sites folder, but if I access the page http://localhost/~soren I get a 403 error:

Forbidden

You don't have permission to access this resource.

I have read several tutorials etc. on the subject, but I still can not make it work.

Here are my access rights to my /Users, ~/ and ~/Sites folder:

drwxr-xr-x   5 root   admin   160 Aug  9 03:14 /Users
drwxr-xr-x@ 64 soren  staff  2048 Aug 11 05:19 /Users/soren/
drwxr-xr-x+  9 soren  staff   288 Aug 10 00:54 /Users/soren/Sites

Excerpt from my /usr/local/etc/httpd/httpd.conf file:

...
LoadModule authn_core_module lib/httpd/modules/mod_authn_core.so
LoadModule authz_host_module lib/httpd/modules/mod_authz_host.so
LoadModule userdir_module lib/httpd/modules/mod_userdir.so
...
# User/Group: The name (or #number) of the user/group to run httpd as.
User soren
Group staff
...
<Directory "/Users/soren/Sites">
    Options Indexes FollowSymLinks Multiviews
    MultiviewsMatch Any
    AllowOverride All
    Require all granted
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
</Directory>
...
# User home directories
Include /usr/local/etc/httpd/extra/httpd-userdir.conf
...

I have tried two different versions of httpd-userdir.conf but none of them work.

Version 1:

# Settings for user home directories
#
# Required module: mod_authz_core, mod_authz_host, mod_userdir

Include /usr/local/etc/httpd/users/*.conf

<IfModule bonjour_module>
       RegisterUserSite customized-users
</IfModule>

/usr/local/etc/httpd/users/soren.conf:

<Directory "/Users/soren/Sites/">
  Options Indexes MultiViews FollowSymLinks ExecCGI
  AllowOverride None
  Require host localhost
</Directory>

Access rights for soren.conf file:

-rw-r--r--  1 root  admin  145 Aug 11 07:29 /usr/local/etc/httpd/users/soren.conf

Version 2:

# Settings for user home directories
#
# Required module: mod_authz_core, mod_authz_host, mod_userdir

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir Sites

<Directory "/Users/soren/Sites">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

What else do I need to do to get this to work?

Edit: Just some more information that I forgot to write.

Here are my directory group rights:

ls -le /Users/:

 0: group:everyone deny delete

ls -le /Users/soren/:

 0: group:everyone deny delete
4
  • What version of MacOS are you running? Have you seen the guides created by Apple discussions user etresoft? discussions.apple.com/docs/DOC-3083
    – Matthias
    Aug 11 '21 at 17:48
  • I have installed MacOS Big Sur. Yes, I have read this guide. It forms the basis of my first edition of httpd-userdir.conf, except that I do not use Perl. Aug 11 '21 at 20:31
  • Is there more information in the log file of the web server?
    – nohillside
    Aug 12 '21 at 4:10
  • My error log shows the following message: [authz_core: error] [pid 2027] [client 127.0.0.1:49356] AH01630: client denied by server configuration: / Users / soren / public_html But I have a hard time figuring out which settings on my Apache server are wrong. Aug 12 '21 at 18:33
0

I do not know exactly what went wrong, but after reinstalling httpd via brew, it all works with my version 2 of httpd-userdir.conf.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .