Should Web Apps Go in /srv or /var/www?
Should Web Apps Go in /srv or /var/www?
Is it better to follow Debian's default webroot policy or FHS? Should I install my web apps in /srv or /var/www?
nginx and Apache in Debian and Ubuntu use /var/www as the default webroot. Arch Linux, on the other hand, uses /srv/http. nginx in FreeBSD uses /usr/local/www/nginx as default webroot. The purpose of */srv*, according to the Filesystem Hierarchy Standard, is:
This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable data and scripts (such as cgi scripts) can be reasonably placed. Data that is only of interest to a specific user should go in that users' home directory.
My Answer
I install web apps to /srv/www and configure httpd (nginx or Apache2) to use that path for primarily these two reasons:
Install web apps out of the webroot for security reasons.
The purpose of /srv's existence.
Another problem was whether to use /srv/www or /srv/http? I'm in the www camp because the greater Debian ecosystem prefers it to http (see: www-data user and group).