I am running Apache 2.2 on Ubuntu 14.04.4 LTS on a Linode server. I have multiple domains hosted on this machine (with only 1 IP address).
I have a domain tbw.com hosted here for which I have an SSL certificate, and for which I want all http://tbw.com and http://www.tbw.com queries to be redirected to https://www.tbw.com (this is happening in the current configuration)
However, when I try to access https://www.rf.com, it gives an error:
Your connection is not secure ... www.rf.com uses an invalid security certificate. The certificate is only valid for the following names: www.tbw.com, tbw.com Error code: SSL_ERROR_BAD_CERT_DOMAIN
- I don't want this to happen - I would rather it show the standard / expected "Secure Connection Failed" error for the non SSL domains.
- Can I have other domains with SSL certs installed on the same machine (same IP address)?
I have looked at the following posts, but I think the answers are dated because SNI (Server Name Indication) now exists.
My configuration files:
... <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ...
NameVirtualHost *:80 NameVirtualHost *:443 Listen 80 ...
<VirtualHost *:80> ServerName tbw.com ServerAlias www.tbw.com DocumentRoot /var/www/html/tbw.com/public_html Redirect permanent / https://www.tbw.com/ </VirtualHost> <IfModule mod_ssl.c> <VirtualHost www.tbw.com:443> ServerAdmin firstname.lastname@example.org ServerName www.tbw.com DocumentRoot /var/www/html/tbw.com/public_html # Log file locations LogLevel warn ErrorLog /var/www/html/tbw.com/log/error.log CustomLog /var/www/html/tbw.com/log/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/ssl/tbw.com/www_tbw_com.crt SSLCertificateKeyFile /etc/apache2/ssl/tbw.com/tbw.key SSLCertificateChainFile /etc/apache2/ssl/tbw.com/www_tbw_com.ca-bundle <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost> </IfModule>