With this Nginx config:

server {

    listen 443 ssl;
    server_name www.x.nl x.nl;

    ssl_certificate /etc/nginx/ssl/x.nl.crtkeyca;
    ssl_certificate_key /etc/nginx/ssl/x.nl.crtkeyca;



This works:

openssl s_client -servername www.x.nl -connect localhost:443 < /dev/null

This doesn't, as I get the default vhost CN:

openssl s_client -servername x.nl -connect localhost:443 < /dev/null

Am using stock Nginx from Ubuntu 12.04 LTS, unfortunately very old (1.1.19).

Is it supposed to work in newer versions or do I require to duplicate my server {} definitions?

  • I'm using such setup successfully with nginx 1.4.6. Jun 15 '15 at 14:08
  • 1
    That should work. Does your certificate really contains both names?
    – Alexey Ten
    Jun 15 '15 at 15:08
  • What does This doesn't mean exactly?
    – sebix
    Jun 16 '15 at 20:23
  • Yes, the cert contains both names. And this doesn't means that I get the certificate from the default vhost/server block.
    – Willem
    Jun 17 '15 at 7:54

I had same issue with Nginx 1.8.0.

In my case, this issue fixes setup different name in ssl_session_cache (see "???"):

ssl_session_cache shared:SSL_???:10m;
  • Hi Jan, I've experienced the same thing on nginx 1.8.0 Do you mean to add ssl_session_cache shared:SSL_differentName:10m; on each http block? Aug 6 '15 at 9:45
  • Hi Erwin, yes, exactly :-) Btw, now i use latest Nginx 1.9.3.
    – jan.reges
    Aug 7 '15 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.