Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I had a Leopard server with a few hundred users (students), and each of them was able to maintain their own web content in their Sites folders in their home directories -- and they could access them (from either inside or outside the network) by going to http://ourdomain.com/~studentname.

Just migrated to a Lion server, and everything is working perfectly, except now visiting any of those home directory sites nets us a 404. I can't find anything in the GUI apps that looks like it could help with this... am I missing something?

I've already tried re-creating the whole OD structure, but that hasn't helped.

share|improve this question
    
Pages 27-40 of the Migration Guilde go over the bulk of the manual migration steps. If you can't try these now, you might want to re-do the upgrade and run these manually to see if an error happened in one of the steps. If you're lucky, it's the apache2 files and not needing to re-migrate the open directory schema... –  bmike Sep 21 '11 at 13:23
    
I've already completely re-run the migration, though not via the individual manual steps -- there's no way I'll have the time to do it that way. I also completely rebuilt the OD schema, with no positive effect. If it's an Apache config problem, what I need to know is: How do I blow out the existing config and get a fresh one? –  Triz Sep 21 '11 at 19:48
    
Other than reviewing the files listed as apache config - I've got no silver bullets. I'd start going over the apache logs, comparing the old config files with the new config files, it's going to be a bit of a chore nailing it down since it could easily be one of ACL, UID or apache configs. Does a newly created user show 404 for their web page? That might point towards or away from apache as the root cause. –  bmike Sep 21 '11 at 20:21
    
Yeah, newly created users also get the 404. –  Triz Sep 22 '11 at 19:51
    
I have just looked at /private/etc/apache2/extra/httpd-userdir.conf which would seem to get included, and contains the UserDir directive as described. going for server/~user I get, in the error log, File does not exist: /Library/Server/Web/Data/Sites/Default/~user so there remains an unexpected interaction –  user21454 Apr 10 '12 at 15:21
add comment

3 Answers 3

up vote 2 down vote accepted

Found it: The UserDir module in Apache2 defaults to public_html. So ~studentname was being directed to /Users/studentname/public_html. Which doesn't exist in any of the users' folders.

What does exist is /Users/studentname/Sites, so I just added this line to the httpd.conf:

UserDir Sites

...and it's working perfectly now. Awesome!

Many thanks to @bmike for pointing me in the right direction.

share|improve this answer
    
So happy you found the surgical option! Do choose this as the accepted answer - I appreciate the thanks. –  bmike Sep 22 '11 at 22:10
add comment

Can we assume you've gone over the following with a fine tooth comb - comparing the prior version to the new Lion versions?

Web configuration data is concentrated in the following files and directories:

  • /etc/apache2/httpd.conf
  • /etc/apache2/httpd_mailman.conf
  • /etc/apache2/httpd_squirrelmail.conf
  • /etc/apache2/magic
  • /Library/WebServer/ Web content

Additional web content is usually in:

  • /Library/WebServer/Documents/
  • /Library/WebServer/CGI-Executables/
  • Any other location where it resides (like the user home folders you are mentioning)
share|improve this answer
    
Since there's nothing fancy about my webserver setup, I'm wondering: Is it safe to just blow all those files out? ie., will apache auto-create a new httpd.conf if it can't find one? –  Triz Sep 22 '11 at 19:50
    
No (I don't think they regenerate without a re-install of the OS) - but here are the contents of my just 5 minutes ago installed clean Lion Server install... cl.ly/AMdc - use tar -tzvf apache2.tgz to view the contents - I did save things absolute - so use care you don't overwrite your /etc/apache2 when you expand these. –  bmike Sep 22 '11 at 22:09
1  
According to this answer, you can reset the web config with sudo serveradmin command web:command=restoreFactorySettings –  Gordon Davisson Apr 10 '12 at 16:14
add comment

Mountain Lion removes personal web sharing as an option as it exposed user IDs. (~username)

Instead of turning it on for ALL users of a system, it is done on a per user basis.

Try the following as root (and substitute your username in place of username)

cd /etc/apache2/users
sed -e "s/Guest/username/g" Guest.conf > username.conf
share|improve this answer
    
Are you referring specifically to Mountain Lion Server? Or just Mountain Lion? Does migrating from Lion to Mountain Lion actually disable personal web sharing if it was previously enabled? –  Triz Jul 30 '12 at 16:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.