0

I am currently setting up a few virtual machines with Ubuntu Server 10.04.02 on them and was wondering what is the best place to store the www files.

I will be using nginx and I see that the default /var/www can be changed to something else. Cpanel uses /home/username/public_html. Is this a good way to store websites?

I would like a simple directory that is easy to remember and to backup.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109

3 Answers3

0

Cpanel is designed to mantain different users(customers) with their own virtual hosts, databases and FTP accounts. Therefor it creates system users and document root is in /home/, which is natural.

Apache has default document root in /var/www, and if you don't have any special urges, you can let it there. Then you can make subdirectories for every virtual host, like this:

/var/www/example.com
/var/www/mail.example.com
/var/www/someothervhost.com

Nagios installation is stored outside of /var deeply in /usr, so you don't have to worry about mixing Nagios files with your own.

mkudlacek
  • 1,677
  • 1
  • 11
  • 15
0

As mkudlacek says ~/public_html is intended for per-user content.

The /var/www location reflects a filesystem layout where webserving is just one of many services provided by a system (on most Unix systems you'll also find /var/mail, /var/ftp etc). Most webservers are single-purpose devices, so using this directory is perhaps not very appropriate - OTOH it is where most people would expect to find the website.

There are different considerations which may affect the location of the web content (running on a seperate filesystem with noatime, a shared filesystem, a high speed SAN...) but within your virtual machine, I'd recommend sticking with /var/www

symcbean
  • 21,009
  • 1
  • 31
  • 52
0

It can be anythintbh, just make sure that the directory has proper permissions. I use this format generally:

/var/www/site.com/public

Lucas Kauffman
  • 16,880
  • 9
  • 58
  • 93
Vamsi Krishna B
  • 213
  • 3
  • 9