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

i want to configure Apache2 so that each user have his/her own DocumentRoot and instead of /var/www put the files in /home/john/www (john is a username smple)

share|improve this question

2 Answers 2

The Apache manual has that covered. Basically, you need to enable a module in your server configuration, set the local path and you're done. In your case, the local path should be something like:

UserDir /home

This automatically expands to /home/username.

In my opinion, though, going with a public_html folder (or similar) is better. This allows your users to store data that is not accessible via web.

share|improve this answer
    
Agreed, this is the setup that I use. –  Webnet Aug 29 '10 at 22:01

You want Apache's mod_userdir module:

http://httpd.apache.org/docs/2.2/mod/mod_userdir.html

Specifically, search your existing configuration files for "UserDir" (might be in the main httpd.conf, in extra/httpd-userdir.conf, or in some other file depending on where you got Apache.) Uncomment it and set it to this:

UserDir www

Remember to enable the mod_userdir module (or uncomment "Include conf/extra/httpd-userdir.conf" in httpd.conf, whichever applies) to allow the module to be loaded!

share|improve this answer
    
thanks, what about ownership and permissions of www? –  Alexar Aug 29 '10 at 21:51
    
@takpar it would work under apache user and group so you would need to either give the right chmods or to create a virtualhost for each domain using suExec and suPHP so both, php and py,perl etc would work under that given user. –  Prix Aug 29 '10 at 22:07

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.