0

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.

3
  • Does the user user exist on your system? And did you restart Apache after doing the config changes?
    – nohillside
    Aug 2, 2013 at 8:39
  • Yes, the user is question is the one I was logged in as (I just changed the username to user here). I ran sudo apachectl restart each time. Do I need to restart through launchctl on OS X Server, perhaps?
    – John Y
    Aug 4, 2013 at 11:00
  • I assume you are using Apache as delivered with OS X. It works for me with the snippets from above, hmm. Is /Users/user/Sites on the local disk? PS: To restart I usually run launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist; launchctl load /System/Library/LaunchDaemons/org.apache.httpd.plist
    – nohillside
    Aug 4, 2013 at 12:49

2 Answers 2

1

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/.

1
  • Thanks! OS X Server's well-documented configuration files strike again...
    – John Y
    Jan 5, 2014 at 12:02
0

Looks like the answer is MAMP and saving £14 on OS X Server next time around.

I'll leave the question open in case anybody can work out what Apple have done in the quest to drool-proof the Server setup, though…

1
  • 1
    It works as documented in the answer referenced from your question for other users, so let's try to figure out what needs to be fixed in your setup to get it to work as well. MAPM/OS X Server are definitively not needed to serve static web pages from a user account.
    – nohillside
    Aug 2, 2013 at 8:42

You must log in to answer this question.

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