<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!&nbsp; 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>&nbsp; server {<br>&nbsp;&nbsp;&nbsp; listen www.example.com:443 default;<br>&nbsp;&nbsp;&nbsp; server_name www.example.com;<br><br>&nbsp;&nbsp;&nbsp; ssl on;<br>&nbsp;&nbsp;&nbsp; ssl_certificate /opt/local/nginx/certs/www.example.com.crt; <br>&nbsp;&nbsp;&nbsp; ssl_certificate_key /opt/local/nginx/certs/www.example.com.key; <br><br>&nbsp;&nbsp;&nbsp; location / {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # ...<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }<br><br>&nbsp; server {<br>
&nbsp;&nbsp;&nbsp; listen www.example.com:80 default;<br>
&nbsp;&nbsp;&nbsp; server_name www.example.com;<br>&nbsp;&nbsp;&nbsp; location / {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # ...<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
<br>&nbsp; server {<br>&nbsp;&nbsp;&nbsp; listen example.com:443;<br>&nbsp;&nbsp;&nbsp; server_name&nbsp; example.com;<br><br>&nbsp;&nbsp;&nbsp; ssl on;<br>&nbsp;&nbsp;&nbsp; ssl_certificate /opt/local/nginx/certs/example.com.crt; <br>&nbsp;&nbsp;&nbsp; ssl_certificate_key /opt/local/nginx/certs/example.com.key; <br><br>&nbsp;&nbsp;&nbsp; rewrite ^/(.*) https://www.example.com/$1 permanent;<br>&nbsp; }<br><br>&nbsp; server {<br>&nbsp;&nbsp;&nbsp; server_name&nbsp; example.com;<br>&nbsp;&nbsp;&nbsp; rewrite ^/(.*) http://www.example.com/$1 permanent;<br>&nbsp; }<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>&nbsp; server {<br>&nbsp;&nbsp;&nbsp; listen 127.0.0.1:443;<br>&nbsp;&nbsp;&nbsp; server_name&nbsp; api.example.com api;<br><br>&nbsp;&nbsp;&nbsp; ssl on;<br>&nbsp;&nbsp;&nbsp; ssl_certificate /opt/local/nginx/certs/api.example.com.crt; <br>&nbsp;&nbsp;&nbsp; ssl_certificate_key /opt/local/nginx/certs/api.example.com.key; <br><br>&nbsp;&nbsp;&nbsp; rewrite ^/(.*) https://www.example.com/$1 permanent;<br>&nbsp; }<br><br>&nbsp; server {<br>&nbsp;&nbsp;&nbsp; listen 127.0.0.1:80;<br>&nbsp;&nbsp;&nbsp; server_name&nbsp; api.example.com api;<br>&nbsp;&nbsp;&nbsp; rewrite ^/(.*) http://www.example.com/$1 permanent;<br>&nbsp; }<br><br><br>Any ideas on how,&nbsp; to setup multiple SSL / HTTPS subdomains, each with their own cert in nginx?<br><br>I've tried many conf variants.&nbsp; 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>