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.

Some web servers I've come across use /home to store the site files:

/home/vhosts/www.example.com/

Others use /var like:

/var/www/www.example.com/

What's more clean and "Linuxy"? Should we all be using /usr/local/www/?

Possible sources: http://www.tuxfiles.org/linuxhelp/linuxdir.html

share|improve this question
    
Shared hosting providers tend to chroot users to their own home directory with their own www (and other services) directories. –  gravyface May 8 '11 at 1:59

2 Answers 2

up vote 9 down vote accepted

According to Chapter 3 of the FHS (Filesystem Hierarchy Standard) 2.3, data for services provided by a server should go under /srv, but leaves the organization under it pretty much in charge of each specific system.

I would recommend /srv/www/<domain> or if the server is providing multiple services per domain something like /srv/<domain>/<service> (service being www, ftp, svn, etc).

share|improve this answer
2  
So if a server provides MySQ servicesL, then the data should go in /srv/sql/dbname? I have never seen any Linux distribution putting data into /srv. And moving the default location for service data (eg /var/lib on Debian) to /srv is just a royal pain. –  Wim Kerkhoff May 7 '11 at 0:29
1  
Well FHS has a rationale for /var/lib too. Just think that in case of /srv/ you are serving files directly from there, while with MySQL you are really reading data from a socket. Also notice that FHS is a suggestion and work in progress so each distribution nas some space to maneuver. –  coredump May 7 '11 at 0:45
    
@Wim: Distributions should not put data into /srv: "... no program should rely on a specific subdirectory structure of /srv existing or data necessarily being stored in /srv." –  Ignacio Vazquez-Abrams May 8 '11 at 1:55

Red Hat and Debian use /var/www. If I was accessing an unfamiliar server, that is the first place I would look for a web server's document root.

share|improve this answer
1  
+1 for sticking with defacto standards/convention. –  gravyface May 8 '11 at 1:56
    
Also +1 for pointing a good place to start. –  Coops Aug 9 '11 at 20:16

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.