I want my website to support both non-SSL and SSL access. What I had to do is copy the non-SSL config and change the port to 443 and add the SSL stuff. Not ideal to administrate!
Is there a way to merge those two configuration?
Here's my current config:
<VirtualHost *:80>
ServerName www.site.tld
ServerAlias site.tld
suPHP_UserGroup site site
DocumentRoot /path/to/site/www
<Directory /path/to/site/www>
AllowOverride All
Order allow,deny
allow from all
Options -MultiViews
</Directory>
ExpiresActive On
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType image/png "access plus 7 days"
ExpiresByType image/x-icon "access plus 7 days"
ExpiresByType image/ico "access plus 7 days"
ExpiresByType text/css "access plus 2 days"
</VirtualHost>
<VirtualHost *:443>
ServerName www.site.tld
ServerAlias site.tld
suPHP_UserGroup site site
DocumentRoot /path/to/site/www
<Directory /path/to/site/www>
AllowOverride All
Order allow,deny
allow from all
Options -MultiViews
</Directory>
SSLEngine On
SSLCertificateFile /etc/ssl/private/site.crt
ExpiresActive On
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType image/png "access plus 7 days"
ExpiresByType image/x-icon "access plus 7 days"
ExpiresByType image/ico "access plus 7 days"
ExpiresByType text/css "access plus 2 days"
</VirtualHost>
Running Ubuntu Server Karmic Koala.
One option is to put the common configuration i separate file, and use the Include directive to have it used in both VirtualHosts.