Ssl – Apache Virtual Hosts with SSL

apache-2.2sslvirtualhost

I have a web server with full root access, which hosts 3 domains. They are on the same IP and managed via VirtualHost files running apache2.

I would like to add SSL capability to one of them, i.e. be able to access the same site via
https://example.com

I have tried everything I found online, but most of them result in apache not serving any content at all.

I'd be glad for any help on how to configure my system to support this.

Thanks,

Tuncay

Best Answer

You have to add to apache conf

NameVirtualHost x.x.x.x:443

with your ip, and then the virtual host

<VirtualHost x.x.x.x:443>
  SSLEngine on
  SSLCertificateFile /etc/apache2/ssl/cert.pem
  SSLCertificateKeyFile /etc/apache2/ssl/key.pem
  SSLCertificateChainFile /etc/apache2/ssl/ca.crt

  # ...
</VirtualHost>