kaanklky
By:
kaanklky

HTTPS connection for just 1 virtual host

December 28, 2014 931 views

I have many virtual host on my droplet, I must run one of them with https.

the https host:
<VirtualHost example2.com:443>
DocumentRoot /var/www/html/example2.com
ServerName example2.com
ServerAlias www.example2.com
SSLEngine on
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM:+SSLv3
SSLCertificateFile /var/www/html/ssl/example2.com/ssl.crt
SSLCertificateKeyFile /var/www/html/ssl/example2.com/ssl.key
</VirtualHost>

and many http host like:
<VirtualHost *:80>
DocumentRoot /var/www/html/example1.com
ServerName example1.com
ServerAlias www.example1.com
</VirtualHost>

When I enter to example2.com, it is OK. I can enter example2.com with HTTPS, but if I try https://example1.com, I see example2.com's content.

Why? and How I can fix it?

1 comment
  • What OS are you using?

    maybe you can change example2 config to something like this.:

    
    <VirtualHost *:80>
    DocumentRoot /var/www/html/example2.com
    ServerName example2.com
    ServerAlias www.example2.com
    </VirtualHost>
    
    <IfModule mod_ssl.c>
    <VirtualHost *:443>
    
    SSLEngine on
    
    DocumentRoot /var/www/html/example2.com
    ServerName example2.com
    ServerAlias www.example2.com
    SSLEngine on
    SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM:+SSLv3
    SSLCertificateFile /var/www/html/ssl/example2.com/ssl.crt
    SSLCertificateKeyFile /var/www/html/ssl/example2.com/ssl.key
    
    </VirtualHost>
    </IfModule>
    
Be the first one to answer this question.