I have two hostnames sharing the same domain name which I want to serve over HTTPs. I've got a wildcard-SSL certificate and created two vhost configs:
Host A
listen 127.0.0.1:443 ssl;
server_name a.example.com;
root /data/httpd/a.example.com;
ssl_certificate /etc/ssl/wildcard.cer;
ssl_certificate_key /etc/ssl/wildcard.key;
Host B
listen 127.0.0.1:443 ssl;
server_name b.example.com;
root /data/httpd/b.example.com;
ssl_certificate /etc/ssl/wildcard.cer;
ssl_certificate_key /etc/ssl/wildcard.key;
However, I get the same vhost served for either hostname.
ssl_certificateandssl_certificate_keythat should be configured insideserverorhttplocation. In your example, you have declared it inside the firstserverlocation, but didn't declare it for the other two vhosts. – Pothi Kalimuthu Oct 27 '13 at 15:06ssl_certificate,ssl_certificate_keyandsslon default_server only. BTW, this config actually works. – Teftin Oct 27 '13 at 15:49sslon thelistendirective for this to work with a 1.4.x nginx. Mylistendirectives in the vhosts also had to be literally the same (logical equivalence was not sufficient). – Dave S. Aug 19 '14 at 17:24