Suppose there is a scenario where we have multiple sites (such as site1.marei.com,site2.marei.com and site3.marei.com) bound to the same ip:port and distinguish between different host headers. We have requested and installed a certificate for each SSL site. When browsing the Web site, the user still sees a certificate mismatch error.
1. Implementation in IIS
When an HTTPS request arrives at the IIS server, the HTTPS request is encrypted and requires a corresponding server certificate decryption request. Because the certificates for each site are different, the server needs to determine which certificate to decrypt with the different host headers in the request, but the master header is also encrypted as part of the request. Eventually, IIS had to use the first site certificate decryption request that was bound to the ip:port, which could result in a failure of the request to another site.
- Solution Solutions
- The first solution binds each HTTPS site to a different port. But then the client must manually specify the port when it browses the page, for example https://site.domain.com:444
- The second solution is to assign a separate IP to each site so that conflicts are resolved and even the host header is not added.
- The third solution is to use a wildcard certificate. We use a wildcard certificate issued to . Domain.com, for our example, the certificate issued to the. marei.com should be used so that any request to access the domain can be decrypted by the certificate, and the certificate matching error will no longer exist.
The fourth solution is to upgrade support for SNI (server Name Indication) added to IIS8,IIS8, and the server can extract the corresponding host header from the request to find the appropriate certificate.
Please refer to the http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-server-name-indication-sni-ssl-scalability for SNi opening method.
2. Implementation in Nginx
Open the Nginx installation directory under the Conf directory to open the Nginx.conf file and locate
server {
listen 443;
server_name domain1;
ssl on;
ssl_certificate 磁盘目录/订单号1.pem;
ssl_certificate_key 磁盘目录/订单号1.key;
ssl_session_timeout 5m;
Ssl_protocols tlsv1 tlsv1. 1 tlsv1. 2
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
On the basis above, add another section of the configuration
server {
listen 443;
server_name dommain2;
ssl on;
ssl_certificate 磁盘目录/订单号2.pem;
ssl_certificate_key 磁盘目录/订单号2.key;
ssl_session_timeout 5m;
Ssl_protocols tlsv1 tlsv1. 1 tlsv1. 2
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
Support multiple certificates in Nginx with the above configuration
Apache configuration HTTPS Virtual host shared 443 port
Listen 443
NameVirtualHost *:443
<VirtualHost *:443>
……
ServerName www.example1.com
SSLCertificateFile common.crt;
SSLCertificateKeyFile common.key;
SSLCertificateChainFile ca.crt
……
</VirtualHost>
<VirtualHost *:443>
……
ServerName www.example2.com
SSLCertificateFile common2.crt;
SSLCertificateKeyFile common2.key;
SSLCertificateChainFile ca2.crt
……
</VirtualHost>
Server Multi-site multi-domain HTTPS implementation