I have a LAMP server running CentOS Stream 8 and Apache 2.4.37. On this I have three domains (let's call them example.com, example.net & example.org). I have SSL certificates for each domain + the www
subdomain.
They share the same codebase (the only difference being the defalt langauge) so they share the same /var/html/www
folder and there is no specific domain level configuration in the /etc/httpd/conf/httpd.conf
file - the ServerName
is example.org:80
I do have a specific configuration in the /etc/httpd/conf.d/ssl.conf
file. Here following is the relevant excerpt - there's a <VirtualHost *:443>
part for each domain.
NameVirtualHost *:443
<VirtualHost *:443>
DocumentRoot "/var/www/html"
ServerName example.com:443
ErrorLog logs/ssl_example_com_error_log
TransferLog logs/ssl_example_com_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
SSLCertificateFile /etc/pki/tls/certs/example_com.crt
SSLCertificateKeyFile /etc/pki/tls/private/example_com.key
SSLCACertificateFile /etc/pki/tls/certs/example_com.ca-bundle
</VirtualHost>
The SSL certificate for each domain works for the main domain, but only works for the www
subdomain of example (which is the first listed) in the ssl.conf
file. So if I try to access https://www.example.net or https://www.example.org, I get a Connection not secure
and Warning: Potential Security Risk Ahead
from the browser.
What works:
https://example.com
https://example.net
https://example.org
https://www.example.com
What doesn't work:
https://www.example.net
https://www.example.org
I cannot find any hint as to what could be happening in the logs. Does anybody have an idea where I could be looking?
I've tested and whatever domain's VirtualHost
section is listed first is the one for which the www
SSL works.