Apache how to have 2 virtual host https? – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, virtualhost, https, port-443, .
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>
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
.