You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apache2: UserDir Sites

On Mountain Lion w/ Server installed:


All I want is for:

http://localhost/~user

to work


I have played with UserDir setting in httpd.conf (it's actually in /private/etc/apache2/extra/httpd-userdir.conf - but I've played with moving it around from there to httpd.conf, etc.)


For the life of me I can't get it to work.


ownership/perms for Sites:
drwxr-xr-x 3 user staff 102 Jul 29 10:04 Sites


http://localhost/~user results in a 404


The error in the logs is:

[Tue Jul 31 17:13:21 2012] [error] [client fe80::226:8ff:fee1:382] File does not exist: /Library/Server/Web/Data/Sites/Default/~user


This has to be stupid simple but I'm not seeing it.


mod_userdir is there and being loaded (not commented out).

I see nothing that would stop this but, obviously, it's not working (unless it's the group on the Sites directory).


Any help is appreciated.


From /private/etc/apache2/extra/httpd-userdir.conf:

#

# 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>


That tells me that it should just do the UserDir Sites bit. I've tried it with/without the user.conf file which is included at the bottom.


What am I missing?


Thanks,

Brad

Mac mini, Mac OS X (10.7.3)

Posted on Jul 31, 2012 2:18 PM

Reply
20 replies

Aug 5, 2012 1:07 PM in response to Brad Bishop

The directory permissions aren't set. I'm not sure why this worked earlier, it wasn't set in the previous Apache configuration under Lion, as far as I can tell. Maybe Mountain Lion has a newer, stricter version of Apache?


You need to edit /etc/apache2/extra/httpd-userdir.conf to add something like this (of course you need root access to edit this):


<Directory "/Users/*/Sites/"> Options Indexes Order allow,deny Allow from all </Directory>



Edit that to include whatever directives you want the users to have.


Then do a "apachectl configtest" to check for errors (it's OK to ignore the one about the server name if this is just for your own use), and "sudo apachectl restart" to get apache to see the new configuration.

Aug 7, 2012 8:30 PM in response to Brad Bishop

I wouldn't edit /etc/apache2/extra/httpd-userdir.conf as previously suggested. Leave it as is. mod_userdir should be able to find your users' homes and if it can access the Sites directory within, it will just work. Well, it will work if you edit these two files:


/Library/Server/Web/Config/apache2/httpd_server_app.conf

/Library/Server/Web/Config/apache2/httpd_server_app.conf.default


In both files, uncomment line 532:


Include /private/etc/apache2/extra/httpd-userdir.conf


Once you do that, restart the web service and try again.


Note: userdir will be enabled for all sites. If you only want it to be enabled for some sites, then you need to make a "webapp" that includes the /private/etc/apache2/httpd-userdir.conf file.

Aug 8, 2012 7:10 AM in response to Blaidd Drwg

I think you still need to edit httpd-userdir.conf - granted, I'm working on Mountain Lion without Server installed so my configuration differs a little. But compare the httpd-userdir.conf that Brad posted above with the one that comes from the MacPorts version of apache:


# 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 # # Control access to UserDir directories. The following is an example # for a site where these directories are restricted to read-only. # <Directory "/Users/*/Sites"> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory>



Apple has removed part of the default configuration and replaced it with the bonjour configuration (but left a confusing "as in the example below").


Without the <Directory> settings for the user directories, Apache reverts to the defaults that are set in the main conf file, and which deny all access:

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory>

Aug 8, 2012 7:29 AM in response to Joseph Delaney

One correction to the above - Apple replaced the <Directory "/Users/*/Sites"> section with an include to files in the /etc/apache2/users/ directory (plus the bonjour stuff). So it's possible that the <Directory "/Users/*/Sites"> section is moved there - check that first before editing httpd-userdir.conf. And if you don't want to edit httpd-userdir.conf, just put that block of text into a conf file in the /etc/apache2/users/ directory.


In Mountain Lion without Server installed, the /etc/apache2/users/ directory is empty, so these settings definitely needs to be added in one of these two places.

Aug 8, 2012 9:39 AM in response to Joseph Delaney

I don't think those changes are required for the basic userdir functionality--they weren't in my testing on Server anyway. (And I haven't tried enabling Web on non-Server Mountain Lion systems. It seems the checkbox for Personal Web Sharing is gone from Sharing System Prefs!) But, you've got a fair point that the default configuration may not provide your desired Apache configuration within the userdir (options, overrides, etc). But I would still say don't edit /etc/apache2/extra/httpd-userdir.conf. If you need them, put them in a separate file in /etc/apache2/users/.


Of course, it will work either way, but Apple seems to be steering you to the /etc/apache2/users/ directory with that include statement that you pointed out. Also, it remains to be seen if edits to /etc/apache2/extra/httpd-userdir.conf will survive a software update. (Speculation: Probably not if the update contains a new /etc/apache2/extra/httpd-userdir.conf file.) It seems more likely (although to be fair this is also not yet proven) that your edits will survive a software update if they are in a separate file in /etc/apache2/users/.

Aug 17, 2012 8:14 AM in response to Blaidd Drwg

Blaidd Drwg wrote:


... Well, it will work if you edit these two files:


/Library/Server/Web/Config/apache2/httpd_server_app.conf

/Library/Server/Web/Config/apache2/httpd_server_app.conf.default



Whoa, whoa, whoa... NEVER edit the .default file. That is the "template" default file as delivered from the vendor, and should only be used as a reference as to how things were setup when the system was virgin. In a pinch, you can always re-copy it to a new .conf file to start over from scratch.


Nope, just edit the .conf file and you'll be good to go.

Aug 26, 2012 1:50 AM in response to Michael Zyda

I had always (from Tiger?) used Web Sharing to host local development sites under ~user/Sites.

My latest setup was Lion Server (default install on a newish macmini server), but continued to use Web Sharing, rather than that provided by the server app.


So, on upgrading to ML + OSX Server, I was frustrated to discover that this no longer worked. However, it is an easy fix, once known!


I can confirm what Blaidd Drwg has written above. OSX Server has its own path for the apache configuration file, which is different to that used by Web Sharing. Edit

/Library/Server/Web/Config/apache2/httpd_server_app.conf

to remove the # from the Include directive

# User home directories

# Include /private/etc/apache2/extra/httpd-userdir.conf

will get user directories up and running again, once you have stopped and restarted apache in OSX Server.


I'm not sure what is needed on a clean install of ML + OSX Server, as the above requires the user configuration files to be in place. Perhaps someone else can clarify that.

Jan 16, 2013 3:47 PM in response to Brad Bishop

I was having a similar issue. I am on 10.8.2 with Server. However, my Users's folders are not in the default location, they are on a Xsan volume. Just commenting out Line 532 as described above would turn on User home directory listings, but only for those users that were actually in /Server HD/Users/*/Sites. I wanted a different set of home folders. I finally was able to do it by uncommenting Line 532 and then editing my /etc/apache2/extra/httpd-userdir.conf file as follows:



# Settings for user home directories

#

# Required module: mod_userdir

#

# Comment out this line to keep /Server HD/Users/*/Sites folders from displaying

# UserDir Sites


#

# 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>


# add the full path to the folders I actually want

<IfModule mod_userdir.c>

UserDir /Volumes/XSANVOLUME/USERS/*/Sites

</IfModule>

Jan 16, 2013 4:05 PM in response to Brad Bishop

What you need to do is add a file to folder

/Library/Server/Web/Config/apache2/other/


called


Username.conf


or whatever your name is.


the file would contain a config like this:


<IfModule apple_userdir_module>

UserDir Sites

</IfModule>


<Directory "/Users/username/Sites">

AllowOverride All

Order allow,deny

Allow from all

</Directory>


The file should be 646 root:wheel

The folder should be 747 root:wheel


Lastly, the file at

/Library/Server/Web/Config/apache2/httpd_server_app.conf


needs a directive that says:

Include /Library/Server/Web/Config/apache2/other/*.conf


Most likely the line is there but only needs to be uncommented.

Restart "Web" of Server.app and your stuff should be up.

Jul 9, 2013 3:04 PM in response to Brad Bishop

Using a "webapp" might be a good option if all you want to do is enable user directories on individual sites and you don't want to modify any Apache conf files. Save the following plist to /Library/Server/Web/Config/apache2/webapps/org.apache.httpd.userdir.plist:


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>displayName</key>

<string>User Directories</string>

<key>includeFiles</key>

<array>

<string>/etc/apache2/extra/httpd-userdir.conf</string>

</array>

<key>installationIndicatorFilePath</key>

<string>/etc/apache2/extra/httpd-userdir.conf</string>

<key>name</key>

<string>org.apache.httpd.userdir</string>

<key>requiredModuleNames</key>

<array>

<string>mod_userdir.so</string>

</array>

<key>sslPolicy</key>

<integer>0</integer>

</dict>

</plist>


Then edit your site in Server.app, click the advanced settings button, and check the "User Directories" box:

User uploaded file


After clicking "OK", user directories should be enabled on your site.

Dec 13, 2013 8:28 PM in response to Brad Bishop

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


http://apple.stackexchange.com/questions/59798/apache-2-userdir-problem-in-os-x- mountain-lion-10-8-server-after-upgrade-fro/59836#59836


If you look /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 a DocumentRoot at...oh. /var/empty. But it does talk a lot about 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 for us noobs, but we can't have everything. Where would we put it?


After reading that answer, I came back through my tabs that appeared to have useful info that I didn't understand, and then I got what Gnarlodious and Blaidd Drwgwere trying to explain, but hadn't made clear enough for my little brain. Two apaches. Blech.

Apache2: UserDir Sites

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.