Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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/domain.com /var/www/domainb.com

and then

/home/user/domain.com is a symlink or bind mount to /var/www/domain.com /home/userb/domainb.com is a symlink/bind mount to /var/www/domainb.com

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

 
discard

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.