I’ve been trying to move a site that was hosted on it’s own server to a server that will be shared with another site (the first site is being phased out so cutting down on hosting costs). I’ve moved everything over and generated new certificates for the domain on the new server successfully using
When I try to visit the site on the new server (DNS switchover completed), however, I get errors from the browser saying NET::ERR_CERT_COMMON_NAME_INVALID. If I examine the certificate in the browser it shows it’s using the certificate for one of the other domains on the server.
It would seem the fault lies with the nginx setup pulling the wrong certificate, or redirect the the other site by default, but this is the exact same config file used on the previous server…
your second part is "special". If you have a 443 listen and a redirect to https / port 443, this is a loop.
So remove your second server complete and add the server name www ... to your first server. And your third server should have the same two server_names.
The 139. address is the new server (which is also hosting the mystraldesign.com domain), the 45. address is the old server. The name-servers haven’t changed, though, and both the www and non-www entry have the 139. entry in the DNS manager of the hosting company (using their name-servers).
I just ran an nslookup and I’m getting the correct responses
It would also appear that the domain is going to the correct server with both addresses (www and non-www) as the incorrect certificate that is being served is one from a domain hosted on that server; the certificate for api.mystral.xyz
The problem is fixed. It was a bad Symbolic Link between the nginx sites-available and sites-enabled directories causing the server the use the default config, hence why the wrong certificate was showing.