MacOS – Getting per-user websites working on Mountain Lion server

macososx-server

I followed the instructions at this question but I am getting 404s when trying to access http://localhost/~user.

The httpd error log shows the following message:

[Tue Jul 23 20:34:34 2013] [error] [client ::1] File does not exist: /Library/Server/Web/Data/Sites/Default/~user

The userdir module is being loaded, and the Include /private/etc/apache2/extra/httpd-userdir.conf line is not commented out.

If I put a deliberate error in /etc/apache2/users/user.conf, apachectl configtest will fail, so it is reading this file — which means /etc/apache2/extra/httpd-userdir.conf is fine as well.

Without the error, user.conf reads

<Directory "/Users/user/Sites/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
</Directory>

and httpd-userdif.conf reads

# Settings for user home directories
#
# Required module: 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

#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
       RegisterUserSite customized-users
</IfModule>

Does anybody have any idea what could be going wrong here? (And also, why Apple didn't just leave well alone and have this working by default, like it did in earlier versions of OS X? 🙂

Edit: Interestingly, if I change Userdir Sites to Userdir /Users/*/STUFF I still get the same error message, with the original path — so Apache seems to be ignoring this line entirely. Sometimes I think we'd be better off with a slide rule.

Best Answer

I also had this problem, and (after only a few hours of head-to-desk impact) found the answer here on AD, from 16 months ago.

Apache 2 `UserDir` problem in OS X Mountain Lion (10.8) Server after upgrade from Lion (10.7)

If you look at /etc/apache2/httpd.conf and your DocumentRoot is /Library/WebServer/Documents/, you might not notice that the error you're getting is about a DocumentRoot with a subtly different name.

/Library/Server/Web/Config/apache2/httpd_server_app.conf refers to serving stuff out of /Library/Server/Web/Data/, which corresponds the server you seem to be running.

You (like me) may be a bit surprised about that. It would've been nice for the Server.app install to drop a helpful README in /etc/apache2. You wisely tested that you had the correct config directory, but were thwarted -- httpd_server_app.conf #includes a bunch of files from /etc/apache2/extra/.