Task is to configure apache to dynamicaly use subdomains of existing folders
First of all we need to enable
vhost_alias module
sudo a2enmod vhost_alias
Then describe our sites
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mass
mac@scx050d06a:/$ cat /etc/apache2/sites-available/mass
<Directory /home/mac/Sites/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName simple.scx050d06a.co.id
ServerAlias *.simple.scx050d06a.co.id
VirtualDocumentRoot /home/mac/Sites/simple/%0/
</VirtualHost>
<VirtualHost *:80>
ServerName zf.scx050d06a.co.id
ServerAlias *.zf.scx050d06a.co.id
VirtualDocumentRoot /home/mac/Sites/zf/%0/public
</VirtualHost>
Now create
/home/mac/Sites/simple/test1.simple.scx050d06a.co.id/index.php
and it will be accessed on test1.simple.
scx050d06a.co.id
Or for Zend example
/home/mac/Sites/zf/test1.zf.scx050d06a.co.id/public/index.php
and it will be accessible on test1.zf.
scx050d06a.co.id