Mobile app version of vmapp.org
Login or Join
Yeniel560

: How to organize /var/www/ for multiple users and vhosts in apache I've been creating new directories for each site in the var folder like this: /var/www -- localhost -- owned by localuser:www-data

@Yeniel560

Posted in: #Apache #Users #Virtualhost

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

1 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel560

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme