A Directory Structure For Domain Virtual Hosting

Over time I have come up with a simple and effective strategy to separate content, applications and application data. By breaking up website content into smaller, more general components I am able to gain the flexibility that my clients require. Content
Resources that are used by a particular service (not a Web application). HTML, PHP and images are typical examples of content for a webserver. Welcome banners are an example of possible FTP server content.
Web application
Third party applications that run within a web server. Since I am a heavy Gentoo user I only install packages if there is an ebuild available. Examples would be applications like PyBlosxom or SquirrelMail.
Web application data
The user's data that is used by the web application. Data for a MoinMoin wiki or blog posts are examples of web application data.
The basic path structure is /srv/{fqdn}/{service}/{...} where:
{fqdn} is a fully qualified domain name {service} is a descriptor for the service being virtual hosted {...} is service specific files/directories
The /srv/ is defined as a path that contains "data for services provided by the system" by the FHS (Filesystem Hierarchy Standard). The FHS only defines it's existence and not the details of it's structure. For my setup I define the structure as /srv/{fqdn}/{service}/{...}. Each fully qualified domain name has it's own subdirectory under /srv. I always use the fqdn to make it less likely that I will get confused. Most of the domains I host have 2 or more subdomains or it is nice to keep everything partitioned. The /srv/{fqdn}/ directory contains a subdirectory for each service that is virtual hosted for the domain. All of the data that is served for the domain resides in one of these subdirectories. Example structure for www.roninds.net:
/srv/vvv.roninds.net/ftp /srv/vvv.roninds.net/mail /srv/vvv.roninds.net/www
Future posts will elaborate a further on this topic.
blog comments powered by Disqus