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)
2 Answers
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.
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!
-
-
@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.– PrixAug 29, 2010 at 22:07