4

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?

2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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