0

I used to create a user called company_xyz and serve the httpdocs file from /home/company_xyz/web/project1/public and so on for each different project. Is there a guideline or best practice on where to serve the vhosts files, I saw few using /var/www/vhosts/projectx with the owner and group set to apache. Does it matter, or is it just a matter of personal preference?

kasperd
  • 30,455
  • 17
  • 76
  • 124
Yehia A.Salam
  • 97
  • 1
  • 2
  • 12
  • There is no right way for this. You can put them wherever you want. I like to put them in `/var/vhosts`. The folder belongs to root. The vhost folder belongs to the webserver user if the app needs write permissions otherwise it belongs to root. – Christopher Perrin Oct 11 '14 at 19:56

1 Answers1

1

Apache itself simply follows whatever values you configure for the source of content e.g. in the DocumentRoot or Alias directive. Except for a few obviously bad locations (/root or /tmp come to mind) as long as your configuration is correct, any directory suffices.

There are a number of good answers under the following question as well: what permissions for my website

Traditionally personal homepages are served from the users ~/public_html folder in their home directory.

For some Linux distributions /var/www has become the "default location" for websites (that mainly implies that there suitable SELinux or AppArmor default policies have been applied).

If you have multiple users, each uploading their own website, or project, then you may at least benefit from a scheme that hosts the site content within their home directory. That at least allows uploading combined with a chroot jail and prevents your user from easily browsing the complete file system. That typically will require the sysadmin setting up the site before it becomes available.

HBruijn
  • 77,029
  • 24
  • 135
  • 201