Nginx not loading different certs on two hosts

Nikolaos Milas nmilas at
Fri Dec 11 11:44:06 UTC 2020

On 10/12/2020 4:42 μ.μ., Maxim Dounin wrote:
> How do you test it?  Note well that the second vhost is only
> available on port 443 via IPv6.
>> Finally, what is the best way to successfully listen (i.e. the suggested
>> way to configure the "listen" directives) to 80 and 443 ports on both
>> IPv4 and IPv6 on all hosts (each and every one of them)?
> The recommended approach is to list all relevant "listen"
> directives in all relevant servers.

Hi Maxim,

Thank you for your reply!

I used the listen directives as you suggested on both vhosts and then I 
retried. After restarting nginx, both vhosts worked fine, both with http 
and https!

Please note that with the initial config (as I had sent it), the second 
vhost was in fact responding to IPv4 clients as well, (through the use 
of ipv4-mapped ipv6 addresses). Actually, the second vhost used to work 
ONLY with http.

When the second site was being accessed via https, it would produce an 
SSL warning, and by checking the certificate details I could see that it 
was the one used for the first vhost.

If I would ignore the security warning and accept the certificate, it 
would continue, yet it would not load the expected page specified by the 
URL but a 404 page.

So, for example, the URL:

would work fine, but the URL:

wouldn't load, either the correct cert or the page!

I couldn't find any associated error in vhost logs.

I haven't been able to understand the above described behavior! In any 
case, everything works fine now!

Thanks again!

All the best,

More information about the nginx mailing list