SSL with nginx on subdomain not working
- by peppergrower
I'm using nginx to serve three sites: example1.com (which redirects to www.example1.com), example2.com (which redirects to www.example2.com), and a subdomain of example2.com, call it sub.example2.com. This all works fine without SSL.
I recently got SSL certs (from StartSSL), one for www.example1.com, one for www.example2.com, and one for sub.example2.com. I got them set up and everything seems to work (I'm using SNI to make all this work on a single IP address), except for sub.example2.com. I can still access it fine over non-SSL, but on SSL I just get a timeout.
If I go directly to my server's IP address, I get served the SSL certificate for sub.example2.com, so I know nginx is loading the certificate properly...but somehow it doesn't seem to be listening for sub.example2.com on port 443, even though I told it to.
I'm running nginx 1.4.2 on Debian 6 (squeeze); here's my config for sub.example2.com (the other domains have similar configs):
server {
server_name sub.example2.com;
listen 80;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/sub.example2.com/server-unified.crt;
ssl_certificate_key /etc/nginx/ssl/sub.example2.com/server.key;
root /srv/www/sub.example2.com;
}
Does anything look amiss? What am I missing?
I don't know if it matters, but StartSSL lists the base domain as a subject alternative name (SAN); not sure if that would somehow pose problems, if both subdomains list the same SAN.