Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a LAMP-based website/application and I'm preparing to start serving clients. With my current system, each client would need a full website instance (full folder structure from web-root up). I would like to separate out the core application while only creating the necessary customized files for each client.

Here's what I'm looking for: A way to say "if the file exists in the client folder, use that one. Otherwise, use the file from the core application folder." A sort of conditional or prioritized symlink, but working for a whole folder tree. That way I won't have to change code throughout the framework, and the separation can happen transparently to the application.

Does this functionality exist in Linux, or is it something I'd need to implement myself in the web server?


share|improve this question

You can use a union filesystem like aufs or UnionFS to overlay directories on top of each other. Accessing a file involves checking the overlays in a specific order until the file is found.

share|improve this answer
I will look into this. The ordered-overlay system is exactly what I was envisioning and having trouble describing. Thanks. – user1259576 Feb 26 '13 at 18:04

The common method to this is to use a folder structure for your app that supports this, like /app for the common code and /config for the local config. You then symlink /app to a common source code directory and have an actual directory for /config. This is easy to reproduce and effective. Among other things, it allows for a very easy update option as you just have to replace one common directory.

I would consider this as a very basic quality criterion and suggest to fix your app to allow this.

Beside this, the functionality you originally asked for doesn't exist.

share|improve this answer
I tried this approach first, however at the core is a pretty bloated CMS (I realize the downsides of this, a separate discussion...) that is really going to be a bear to recode for this. I may keep implementing this method, but it just seemed like there might be an easy way to handle it beneath the application. – user1259576 Feb 26 '13 at 16:20
Doing this with Drupal took all of two symlinks. Maybe it was three. I don't remember, but it is in git... – Michael Hampton Feb 26 '13 at 20:24

What you describe is usually accomplished through versions. The most used versioning systems lately are Subversion and Git.

If you set up a base repository you can branch it for every customer installation and provide patchs and diffs as necessary to modify the sources. Since you will have diferent branches of the main application you will have to test the patches applied on the base application for every branch, but there's really no other way around this.

Since you are using Linux and both SCM are provided with all the major distros you will not have much hassle setting up any of them.

share|improve this answer

Your Answer


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.