10

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

Robert
  • 14,423
  • 4
  • 18
  • 14
  • Shared hosting providers tend to chroot users to their own home directory with their own www (and other services) directories. – gravyface May 08 '11 at 01:59

2 Answers2

9

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).

coredump
  • 12,573
  • 2
  • 34
  • 53
  • 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 07 '11 at 00:29
  • 1
    Well [FHS has a rationale](http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION) 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 07 '11 at 00: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 08 '11 at 01:55
7

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.

sciurus
  • 12,493
  • 2
  • 30
  • 49