1

I have been working on this for several hours now, to no fruition. Right now I have three domains, for example domain1.com, domain2.org, and domain3.net. These domains are all using the same IP address.

domain1 and domain2 each have an individual SSL certificate from a trusted authority. domain3 has a self-signed certificate, which, while not ideal, is sufficient in this case (not that this should make any difference, I believe).

The problem is, the correct sites are being served when visited by domain, but when accessing via IP address, domain3 is served with domain3's certificate, and I can't for the life of me figure out how to get it to use domain1 instead... ideally any request made to the IP would be redirected to domain1.com.

Any help would be appreciated.

Aethereal
  • 13
  • 2

2 Answers2

1

According to nginx documentation, you can specify which site will be the default one when there is no matching server name, this with the default_server parameter.

From the documentation :

server {
     listen      443 default_server;
     server_name example.net www.example.net;
    ...}
Charly
  • 101
  • 4
0

Add the IP address to the server_name for the server you want to serve it.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
  • Thanks, I did try this but for some reason it didn't work... Maybe I had messed up configuration elsewhere. – Aethereal Feb 28 '14 at 21:51