I might be able to almost solve your problem

I use one central script as well to allow for minor changes when I actually serve it to a host. The trick is to use the Include directive inside VirtualHost sections.
I use it to customize various parts per website while keeping most of the configuration generic.
Per website (/etc/apache2/sites-available/mysite.com):
Quote:
<VirtualHost *:80>
ServerName mysite.com
Include /etc/apache2/sites-available/generic.com
CustomLog /var/log/apache2/mysite/access.log combined
<IfModule mod_php5.c>
php_value memory_limit 64M
php_value max_execution_time 45s
</IfModule>
</VirtualHost>
|
Generic (/etc/apache2/sites-available/generic.com):
Quote:
# This file must be included inside a VirtualHost spec
#<VirtualHost *:80>
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
#</VirtualHost>
|
The same website but now accessible via ssl (/etc/apache2/sites-available/mysite-ssl.com):
Quote:
<VirtualHost *:443>
ServerName mysite.com:443
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
Include /etc/apache2/sites-available/generic.com
CustomLog /var/log/apache2/mysite/ssl_access.log combined
</VirtualHost>
|
After than enable both sites via a2ensite mysite.com; a2ensite mysite-ssl.com
Hope this helps.