3

I am trying to explain some students what are the differences between having www on the home folder, for example /home/cyrex/www and in the /var/www. So I wanted to ask here what are the benefits of having it in the home folder instead of the default one.

2 Answers 2

4

Keeping web folders in user's home directory is good for 2 reasons mainly:

  1. If you have a web server with multiple users, keeping www folder in user's home directory will help you organizing, you can -as a administrator- easily know which user has what in her web folder.
  2. Second issue, well, actually the main issue is, security. By default Apache runs by a single user: www-data. However, if you have multiple web sites -owned by different users, let's say customers- running on a single server, and if you make www-data user own those web folders, users won't be able to make any modification in those folder via ssh, ftp, etc. Hence, to overcome this issue, you need to run apache with another user account for each user's web directory (apache-mpm-itk, suPHP and some other software helps you do this). In this case, keeping web folders of each user in user's home directory is the best. Because a user can do modifications on her own web directory connecting via ssh, ftp or any other method.
1

Honestly all I can think of is for a multi-customer server. FTP logins would go to their ~/ or ~/www/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .