SSL_ERROR_BAD_CERT_DOMAIN with multiple domains

BeyondEvil nginx-forum at
Sat Jun 22 20:01:40 UTC 2019

I have two domains:


(1) is under my control (I own the domain) and I manage the certs (Let's
If I visit "" I'm greeted by the "Welcome to
Nginx!" landing page. (I use nginx as a reverse proxy only.)

(2) is a DDNS that Synology manages and it also has certs by LE (managed by

I have a Mac Mini running the "main" Nginx server and a bunch of other
services. (1) points to theses services on the Mini. The IP of the mini is

(2) points to a NAS that has it's own Nginx to handle, among other things,
the LE certs. This machine runs on IP
Without any settings in the "main" nginx, I can't use (2) because in my
router (EdgeRouter X) both :80 and :443 point to the Mini (

So I need to add two new server blocks in my config so that:
If I visit "" (port 80) that redirects me to
If I visit "" (port 443) that redirects me to

I've managed to get part of the way. But I'm getting SSL errors like for
instance:  "SSL_read() failed (SSL: error:14094412:SSL
routines:ssl3_read_bytes:sslv3 alert bad certificate:SSL alert number 42)
while waiting for request, client:, server:"

What am I doing wrong?

Here's my current config:


Posted at Nginx Forum:,284630,284630#msg-284630

More information about the nginx mailing list