<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'><div style="text-align: left;">Hi Nginx Group,<br><br>Just wanted to start off by saying nginx is a rad web server! Na zdrowie!<br><br>So we've noticed some issues with setting up https ssl certificates over multiple subdomains.<br><br>The base domain (example.com) and the first subdomain (www.example.com) work beautifully:<br><br> server {<br> listen www.example.com:443 default;<br> server_name www.example.com;<br><br> ssl on;<br> ssl_certificate /opt/local/nginx/certs/www.example.com.crt; <br> ssl_certificate_key /opt/local/nginx/certs/www.example.com.key; <br><br> location / {<br> # ...<br> }<br> }<br><br> server {<br>
listen www.example.com:80 default;<br>
server_name www.example.com;<br> location / {<br>
# ...<br>
}<br>
}<br>
<br> server {<br> listen example.com:443;<br> server_name example.com;<br><br> ssl on;<br> ssl_certificate /opt/local/nginx/certs/example.com.crt; <br> ssl_certificate_key /opt/local/nginx/certs/example.com.key; <br><br> rewrite ^/(.*) https://www.example.com/$1 permanent;<br> }<br><br> server {<br> server_name example.com;<br> rewrite ^/(.*) http://www.example.com/$1 permanent;<br> }<br><br>NOW, If the following is added, the correct SSL cert for api.example.com is not loaded before the redirect, the www.example.com cert is loaded instead:<br><br> server {<br> listen 127.0.0.1:443;<br> server_name api.example.com api;<br><br> ssl on;<br> ssl_certificate /opt/local/nginx/certs/api.example.com.crt; <br> ssl_certificate_key /opt/local/nginx/certs/api.example.com.key; <br><br> rewrite ^/(.*) https://www.example.com/$1 permanent;<br> }<br><br> server {<br> listen 127.0.0.1:80;<br> server_name api.example.com api;<br> rewrite ^/(.*) http://www.example.com/$1 permanent;<br> }<br><br><br>Any ideas on how, to setup multiple SSL / HTTPS subdomains, each with their own cert in nginx?<br><br>I've tried many conf variants. At this point, I'm suspecting it is a bug in nginx, but how would that be possible. =)<br><br>Thanks,<br>Martian<br><br></div><br /><hr />Stay up to date on your PC, the Web, and your mobile phone with Windows Live. <a href='http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/' target='_new'>See Now</a></body>
</html>