Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

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.

share|improve this answer
    
OK, just wondering how people like to do it. Cheers =] –  Dean Perry Mar 8 '11 at 17:43

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

share|improve this answer

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

/var/www/site.com/public

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.