1

I'm trying to configure 2 domains (A and B) in the same server with different certificates. The domain A works fine, it has it's own certificates and rules to redirect to it. If I try to access to domain B it displays the following message:

This server could not prove that it is subdomainB.DomainB.com.mx; its security certificate is from subdomainA.domainA.org. This may be caused by a misconfiguration or an attacker intercepting your connection.

Now if I add domain B it does exactly the same but in reverse.

This server could not prove that it is subdomainA.DomainA.com.mx; its security certificate is from subdomainB.domainB.org. This may be caused by a misconfiguration or an attacker intercepting your connection.

Also I lost the redirects to SubdomainA.domainA.org and it access to php page version, not the site itself.

Hope someone can help me. my config:

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName subdomainB.domainB.com.mx
DocumentRoot /var/www/html/

SSLEngine on
SSLCertificateFile /etc/apache2/sslB/certificate.crt
SSLCertificateKeyFile /etc/apache2/sslB/private.key
SSLCertificateChainFile /etc/apache2/sslB/intermediate.crt

SSLProtocol all -SSLv2 -SSLv3 -TLSv1

</VirtualHost>

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName subdomainA.domainA.com.mx
DocumentRoot /var/www/html/

SSLEngine on
SSLCertificateFile /etc/apache2/sslA/certificate.crt
SSLCertificateKeyFile /etc/apache2/sslA/private.key
SSLCertificateChainFile /etc/apache2/sslA/intermediate.crt

SSLProtocol all -SSLv2 -SSLv3 -TLSv1

</VirtualHost>
Oscar Vazquez
  • 131
  • 1
  • 8

1 Answers1

1

You have to create two different vhost file in sites-available (if in debian based OS)
and load the certificate differently on both domains on two files. Could you post your vhost configuration.

on subdomainA.domainA.com.mx vhost config file write below code.

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName subdomainA.domainA.com.mx
DocumentRoot /var/www/html/

SSLEngine on
SSLCertificateFile /etc/apache2/sslA/certificate.crt
SSLCertificateKeyFile /etc/apache2/sslA/private.key
SSLCertificateChainFile /etc/apache2/sslA/intermediate.crt

SSLProtocol all -SSLv2 -SSLv3 -TLSv1
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName subdomainA.domainA.com.mx
DocumentRoot /var/www/html/
Redirect / https://subdomainA.domainA.com.mx
</VirtualHost>

You can do same on another virtual host of domain subdomainB.DomainB.com.mx.

  • Hello I have edited my question with the configuration, also I'm doing the config in the folder sites-enabled. Can I do there? – Oscar Vazquez Aug 07 '19 at 13:51
  • Hello, I tried it, to put domain a in one conf file and domain b in another but it throws the same error. Also my domain b is redirected to domain A. – Oscar Vazquez Aug 07 '19 at 14:09
  • to redirect https you have to listen on port 80. I have edited the code . I hope this will help you. – Khimananda Oli Aug 08 '19 at 04:18