title: multiple ssl virtual hosts on apache
body: <p>I want to configure two virtual hosts with their own ssl certificates on apache (apache 2.2.22 and openssl 1.0.1, debian 7.6). I've found many articles about SNI, but still can't configure it properly. Here's my config:</p>
  
  <p><strong>ports.conf</strong></p>
  
  <pre><code>    NameVirtualHost *:80
      NameVirtualHost *:443
      Listen 80
      &lt;IfModule mod_ssl.c&gt;
         Listen 443
      &lt;/IfModule&gt;
  
      &lt;IfModule mod_gnutls.c&gt;
         Listen 443
      &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>test1-ssl</strong></p>
  
  <pre><code>&lt;IfModule mod_ssl.c&gt;
  &lt;VirtualHost *:443&gt;
          ServerName test1.com
          DocumentRoot /var/www/test1
          SSLEngine on
          SSLCertificateFile    /etc/apache2/ssl/test1.crt
          SSLCertificateKeyFile /etc/apache2/ssl/test1.key
  &lt;/VirtualHost&gt;
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><strong>test2-ssl</strong></p>
  
  <pre><code>&lt;IfModule mod_ssl.c&gt;
  &lt;VirtualHost *:443&gt;
          ServerName test2.test.pl
          DocumentRoot /var/www/test2
          SSLEngine on
          SSLCertificateFile    /etc/apache2/ssl/test2.crt
          SSLCertificateKeyFile /etc/apache2/ssl/test2.key
  &lt;/VirtualHost&gt;
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Domain <a href="https://test1.com" rel="noreferrer">https://test1.com</a> works properly (with its own certificate).
  Domain <a href="https://test2.test.pl" rel="noreferrer">https://test2.test.pl</a> displays content of domain test1.com and uses test1 ssl certificate instead of test2.crt (as it is defined in config file test2-ssl).
  Any ideas,sugestions very appreciated. </p>
  
  <p>Kind regards,
  and thanks in advance!</p>