I have a development server for PHP programmers set up and runnig for some time now. The system is Debian with default Apache package:
# apache2 -v
Server version: Apache/2.2.9 (Debian)
Server built: Dec 11 2010 18:58:55
I have set up about 30 name based VirtualHosts, one for each project and for each developer. I do the configuration with scripts, but now I have to add about 15 new project, all of them with standard directory structure, so I thought, I will use mod_vhost_alias
I have my config similar to this:
NameVirtualHost *:80
#Default vhost
<VirtualHost *:80>
DocumentRoot /var/www/404
ServerName dev.example.com
ErrorLog /var/log/apache2/404.error_log
TransferLog /var/log/apache2/404.access_log
<Directory "/var/www/404">
allow from all
Options Indexes Includes
AllowOverride All
</Directory>
</VirtualHost>
#this entry is repeated many times
#with different server names, document roots
# and other differences, bu basics stay the same
<VirtualHost *:80>
DocumentRoot /var/www/crm
ServerName crm.dev.example.com
ErrorLog /var/log/apache2/crm.error_log
TransferLog /var/log/apache2/crm.access_log
<Directory "/var/www/crm">
allow from all
Options Indexes Includes
AllowOverride All
</Directory>
</VirtualHost>
# I added Vhost_alias virtaul host today, at the end of the config
<VirtualHost *:80>
# This is for pages similar to some-page.pl.web.example.com
UseCanonicalName Off
ServerAlias *.web.dev.example.com
VirtualDocumentRoot /var/www/web/%-4+/cur
ErrorLog /var/log/apache2/%-4+.error_log
TransferLog /var/log/apache2/%-4+.access_log
<Directory /var/www/%-4+>
allow from all
Options Indexes Includes
AllowOverride All
</Directory>
</VirtualHost>
The result is, when I connect to http://my-page.com.web.dev.example.com I get the default vhost from /var/www/404 directory. The directory /var/www/web/my-page.com/ exists, and contains copy of my-page.com real webpage.
What am I doing wrong? Do I need separate ip addresses for "standard" NameVirtualHost and for vhost_alias? What else should I check?