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

Is it possible that mod_vhost_alias can read several directories (For example, each users) to find the sites? Like in a hosting setup where different users can create the directories in their home directory?

share|improve this question

vhost_alias maps a domain received into a path on the filesystem. It doesn't read the existing filesystem prior to serving the request to see if the files exist.

However, you can do something like have a stable directory listing of files, and use symlinks or bind mounts in the user directories to point to the actual web directories.

/var/www/ /var/www/

and then

/home/user/ is a symlink or bind mount to /var/www/ /home/userb/ is a symlink/bind mount to /var/www/

Remember that mod_vhost_alias runs everything as the user running the apache service. In a shared environment, make sure you know the ramifications for running apache like this.

share|improve this answer
Alright, sweet. Any quick ways to automatically make all those symbolic links? – Kyle Mar 31 '10 at 11:00
When the domain is created, create the domain and the user's symlink. If you are doing it the opposite direction where a user creates a domain directory, uploads content, your script would need to move that to the proper location and leave a symlink in place. Some FTP software won't properly traverse symlinks which is why I suggested the bind mount. With a bind mount, you need to update your /etc/fstab so that the mount comes back if the machine is rebooted. – deleted Mar 31 '10 at 15:29

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.