Daily Archives: July 8, 2008

Apache and multiple SSL virtual host on same IP address

In standard way, apache only supports one SSL virtual host per IP address, if you want to use different SSL Certificates file. But with mod-gnutls it is possible to have multiple Virtual host with different SSL Certificates file.

Install mod-gnutls in Debian:

apt-get install libapache2-mod-gnutls

Then you need to enable mod-gnutls

cd /etc/apache2/mods-enabled
ln -s ../mods-available/gnutls.* .

Then you need to create the gnutls cache files

touch /var/cache/apache2/gnutls_cache
chmod 700 /var/cache/apache2/gnutls_cache
chown 33.33 /var/cache/apache2/gnutls_cache

And then you need to setup the two virtualhost:

<VirtualHost *:443>
ServerAdmin [email protected]
ServerName v1.dalbjerg.nu
DocumentRoot /var/www/v1.dalbjerg.nu
GnuTLSEnable on
GnuTLSPriorities NORMAL
GnuTLSCertificateFile /etc/apache2/v1/ssl.crt
GnuTLSKeyFile /etc/apache2/v1/ssl.key
</VirtualHost>

<VirtualHost *:443>
ServerAdmin [email protected]
ServerName v2.dalbjerg.nu
DocumentRoot /var/www/v2.dalbjerg.nu
GnuTLSEnable on
GnuTLSPriorities NORMAL
GnuTLSCertificateFile /etc/apache2/v2/ssl.crt
GnuTLSKeyFile /etc/apache2/v2/ssl.key
</VirtualHost>

Then you need to restart apache

apache2cl restart

If it don’t work see at /var/log/apache2/error.log to see any error is reporting there.

[ad]