My web development experience has started with Fedora and RHEL but I'm transitioning to Ubuntu. In Fedora/RHEL, the default seems to be using the /var folder while Ubuntu uses /srv.

Is there any reason to use one over the other and where does the line split? (It confused me so much that until very recently, I thought /srv was /svr for server/service)

My main concern deals with two types of folders

  • default www and ftp directories
  • specific application folders like:
    1. samba shares (possibly grouped under a smb folder)
    2. web applications (should these go in www folder, or do can I do a symlink to its own directory like "_/www/wordpress" -> "/srv/wordpress")

I'm looking for best practice, industry standards, and qualitative reasons for which approach is best (or at least why its favored).

link|improve this question

73% accept rate
feedback

3 Answers

up vote 4 down vote accepted

This stems from LSB (http://en.wikipedia.org/wiki/Linux_Standard_Base) which says "/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files." but says this for /srv "/srv contains site-specific data which is served by this system."

SuSE was one of the first disto's that I used that kept webroot's in /srv - typically debian/ubuntu/rhel use /var/www - but also be aware that if you install a web application using yum or apt then they will likely end up in /usr/share

On balanced reflection I would say keep to /var/www - or you can do both by making /var/www a symlink to /srv/www. I know that on oracle RDBMS systems that I build I often create /u01 /u02 etc as symlinks to /home/oracle. the reason for this is that many DBA's expect to find things in /u01 and many others expect /home/orcacle. the same can be said of Sysadmins in general - some will instinctively look in /var/www and some in /srv/www while others like myself will grep the apache config for the DocumentRoot's

Hope this provides some guidance for you.

link|improve this answer
feedback

My answer is a questiion... "/srv vs /var … where do I put stuff?"

I have decided to do it the modern way. Instead of using /var/www/sites or /home/user/public_html I am going to use /srv

Now the question is "where do I put stuff?"

/srv/sites/domain.name or /srv/www/sites/domain.name or /srv/export/sites/domain.name or /srv/export/domain.name

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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