Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I've been creating new directories for each site in the var folder like this:

  • /var/www -- localhost -- owned by localuser:www-data (+setuid/setguid)
  • /var/www-somesite -- somesite.com, somesiteuser:somesitegroup (+setuid/setguid)
  • /var/www-anothersite -- anothersite.org, anothersiteuser:anothersitegroup (+setuid/setguid)

A virtual host points is associated to each of these directories. The apache user www-data is a member of somesitegroup and anothersitegroup

Is there a better practice I should be following for this?

share|improve this question
add comment

migrated from stackoverflow.com Sep 15 '11 at 6:43

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 2 down vote accepted

If you have multiple users with different websites on your server, it's commonplace to place the user's website in a directory within their home folder and use the Apache configuration to point the relevant domain name at the appropriate directory.

/home/somesiteuser/public_html
/home/anothersiteuser/public_html
...etc...

The has the added benefit of allowing for ease of limiting user disk quota and removing their files when you remove the user. It also keeps your default web root clean and makes it easier to run your default website out of /var/www.

share|improve this answer
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.