I have 3 sites defined in apache, site1, site2, site3 For 1 and 2 I requested ssl certs from Let's encrypt and work OK, but NOT for site 3. Problem is that whenever I access https://site3 I always get a certificate from one of the other sites, I think from the first one defined.
Is this how apache should work or my config is wrong ? Not sure what I should see when I have no cert defined, maybe some "no cert" error ?!
/etc/httpd/conf/httpd.conf
# http site 1
<VirtualHost site1.com:80>
DocumentRoot /var/www/html/site1.com
ServerName site1.com
<Directory "/var/www/html/site1.com">
Require all granted
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
# http site 2
<VirtualHost site2.com:80>
DocumentRoot /var/www/html/site2.com
ServerName site2.com
<Directory "/var/www/html/site2.com">
Require all granted
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
# http site 3 (only one WITHOUT ANY SSL)
<VirtualHost site3.com:80>
DocumentRoot /var/www/html/site3.com
ServerName site3.com
<Directory "/var/www/html/site3.com">
Require all granted
DirectoryIndex index.html index.php
</Directory>
</VirtualHost>
Include /etc/httpd/conf/httpd-le-ssl.conf >>>>>>>
/etc/httpd/conf/httpd-le-ssl.conf
# SSL site 1
<IfModule mod_ssl.c>
<VirtualHost site1.com:443>
DocumentRoot /var/www/html/site1.com
ServerName site1.com
<Directory "/var/www/html/site1.com">
Require all granted
DirectoryIndex index.html index.php
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.site1.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.site1.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.site1.com/chain.pem
</VirtualHost>
</IfModule>
# SSL site 2
<IfModule mod_ssl.c>
<VirtualHost site2.com:443>
DocumentRoot /var/www/html/site2.com
ServerName site2.com
<Directory "/var/www/html/site2.com">
Require all granted
DirectoryIndex index.html index.php
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.site2.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.site2.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.site2.com/chain.pem
</VirtualHost>
</IfModule>