You know that by default, servers like nginx and apache use standard directories for sites. Like "public_html", "www". And I noticed that on multi-user setups the sites are placed in the user's home directory


I have such a setup, with nginx and php-fpm, and I want to have a custom directory holding all the sites, outside of the owner's home directory, like


Is this a bad idea? Is there any advantage of using the home dir instead?

Obviously I would chown each sitedir so it belongs to the associated user.


I would say it depends. If each user has its own private website, you could put those in /home/user/public_html but if the website is not personal like that, I would put them in a folder structure like you gave, with them being in /sites/domain/subdomain/.

Having all websites in a single directory makes it easier to give permissions, do backups, possibly put them on a different disk (mount point), etc.

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.