Earlier it was painful to multiple SSL certificate on multiple sites hosted on single IP address. Due to this website administrators need to invest more money to purchase individual IP addresses. However now with the help of SNI (Server Name Indicator) it is possible to protect multiple sites with different SSL Certificates on single Internet Protocol on Apache.
Set up SNI with Apache:
First take a fresh backup of your .conf
Now to achieve above mentioned functionalities, you need to create Virtual Host on your server. Create new .conf file for new Virtual Host or you can use existing. If you are creating a new .conf file you need to add following line into existing .conf file.
Include my_other_site.conf
Now list your public IP addresses in the NameVirtualHost directive by using port *:443. Afterwards you need to point Root Certificate, Intermediate Certificate, and SSL File to the each websites. Check below example for more:
NameVirtualHost *:443
<VirtualHost *:443>
ServerName site1.domain.com
DocumentRoot /var/www/site
SSLEngine on
SSLCertificateFile /path/to/site1_domain_com.crt
SSLCertificateKeyFile /path/to/site1_domain_com.key
SSLCertificateChainFile /path/to/CA.crt
</VirtualHost>
<VirtualHost *:443>
ServerName site2.domain.com
DocumentRoot /var/www/site2
SSLEngine on
SSLCertificateFile /path/to/site2_domain_com.crt
SSLCertificateKeyFile /path/to/site2_domain_com.key
SSLCertificateChainFile /path/to/CA.crt
</VirtualHost>
This should work properly but in my opinion, you should not use different SSL Certificates fro different sites when you can get single SAN (Subject Alternative Names) SSL as you can secure multiple sites with single certificate. And if you have only sub-domains to secure under the one domain then you can simply opt Wildcard SSL, which can be cost effective option. You just need to issue Wildcard certificate as *.domain.com
and everything (only first level) in place of asterisk (*) will be covered.
Both Wildcard SSL and SAN certificate will reduce the cost as well as management hassle. Read this article if you want to understand the difference between Wildcard SSL and SAN.
*.domain.com
.