I have one server hosting two sites and am trying to set up my nginx
vhost.conf to have both sites working with SSL.
My vhost.conf file can be seen here (domain names have been changed):
To clarify, despite using server_name to set which domain a server block
applies to, the secure reddomain.com is following the first ‘listen 443’
it comes across and making use of the incorrect ssl certificate and
giving invalid certificate errors when viewing with a browser.
What confuses matters more is that if we agree to view the page despite
an invalid certificate, the correct app for that domain is loaded (so
although reddomain may get follow the server block of bluedomain, the
outcome is the reddomain app getting loaded).
So my question is:
- For the domains on port 443, why are they following the first server
block that is listening to that port, ignoring the fact that the domain
is not listen in ‘server_name’?
and come anyone see what I may be doing wrong from my vhost.conf, or
bring anything to my attention that may be causing this problem