Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In Mountain Lion personal web hosting via Apache and your ~/Sites folder has been removed (at least without some hacking).

I've read an article explaining how to re-enable it, but I can see that system wide Apache is serving content from /Library/WebServer/Documents as usual.

Thought I might take the opportunity to see if I can symlink my ~/Sites folder to /Library/WebServer/Documents/ somehow so I can avoid the ~/username in the local URL, yet still use my ~/Sites folder as per usual for testing web projects.

Anyone know how best to do this? My Sites folder doesn't seem to be easily changeable, I'm guessing somekind of permissions thing?

Thanks

R

share|improve this question

closed as off topic by Sven, Ward, EEAA, Ladadadada, Scott Pack Aug 25 '12 at 2:27

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Why not just add user Sites back in? The module is still there, they just removed the httpd.conf entry. Just add the line LoadModule userdir_module libexec/apache2/mod_userdir.so back in –  Hawken Aug 2 '12 at 4:59

1 Answer 1

Have you tried to use:
sudo ln -s ~/Library/WebServer/Documents ~/Sites

<-- Edit -->
Forgot to add the escape character in there after "Web".

<-- Edit -->
Corrected path to 'WebServer' rather than 'Web Server' - my fault, it was wrong in question. Rich

share|improve this answer
    
Nope, doesn't work I'm afraid. Nor does trying to change the httpd.conf DocumentRoot property to /Users/<username>/Sites - it gives error on restart that folder must be a directory so I assume OS X is doing something special with 'Sites'. –  Rich C Aug 1 '12 at 12:46
    
~/Sites is not a OS X folder, but a folder you've created. If you want apache to host content from there, make sure the apache user owns the ~/Sites folder, and it has the necessary permissions to use this folder. Do you use MAMP? –  Kao Aug 1 '12 at 12:53
    
Hm, seems the existence of the Sites folder is dependent on how old your OS X is. Reading up it was either removed in Lion, or is dependent on Personal Web Sharing being on. But checking it, it does seem to be owned by myself as a user. I don't use MAMP no, as its overkill for my needs. Any thoughts on this as a route to setting the permissions correctly? stackoverflow.com/a/6419695 - I am a bit dubious of changing permissions on parent folders of Sites since this is my Home directory. –  Rich C Aug 1 '12 at 13:05
    
You should not be required to change the Home directory permissions. Is apache running on the same user as the one that owns ~/Sites? You should be able to use any folder you wish, aslong as you the Apache user owns the folder, and has the required permissions. What error are you getting? –  Kao Aug 1 '12 at 13:09
    
Ok, I've set DocumentRoot to '/Users/<username>/Sites' and changed '~/Sites' to ownership of _www with command 'sudo chgrp -R _www ~/Sites' as well as changed it's permissions with 'chmod -R g+rx ~/Sites'. Now when attempting to browse to '~/Sites/index.html' I set up via the local server I get a 403 forbidden. I'm guessing more of those steps in stackoverflow.com/a/6419695 are needed, more than likely the one that allows other users access to my home directory, although not liking it being so potentially open. –  Rich C Aug 1 '12 at 13:29

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