<div dir="ltr"><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;font-size:12px;font-family:Consolas,'Liberation Mono',Courier,monospace;color:rgb(51,51,51);line-height:16px"><div class="" id="LC1" style="margin:0px;padding:0px 0px 0px 10px;border:0px">
# www fix</div><div class="" id="LC2" style="margin:0px;padding:0px 0px 0px 10px;border:0px">server {</div><div class="" id="LC3" style="margin:0px;padding:0px 0px 0px 10px;border:0px"> # <a href="http://www.example.com">www.example.com</a> -> <a href="http://example.com">example.com</a></div>
<div class="" id="LC4" style="margin:0px;padding:0px 0px 0px 10px;border:0px"> #server_name <a href="http://www.example.com">www.example.com</a>;</div><div class="" id="LC5" style="margin:0px;padding:0px 0px 0px 10px;border:0px">
#rewrite ^ $scheme://<a href="http://example.com">example.com</a>$request_uri? permanent;</div><div class="" id="LC6" style="margin:0px;padding:0px 0px 0px 10px;border:0px"> # <a href="http://www.example.com">www.example.com</a> -> <a href="http://example.com">example.com</a></div>
<div class="" id="LC7" style="margin:0px;padding:0px 0px 0px 10px;border:0px"> server_name <a href="http://example.com">example.com</a>;</div><div class="" id="LC8" style="margin:0px;padding:0px 0px 0px 10px;border:0px">
rewrite ^ $scheme://<a href="http://www.example.com">www.example.com</a>$request_uri? permanent;</div><div class="" id="LC9" style="margin:0px;padding:0px 0px 0px 10px;border:0px">}</div></pre></div><div><br>
</div>
<a href="https://github.com/kirpit/webstack/blob/master/sites/_nginx-example.com.conf">https://github.com/kirpit/webstack/blob/master/sites/_nginx-example.com.conf</a><div><br></div><div>cheers.<br></div><div><div><br></div>
<div><br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 23, 2013 at 12:44 AM, openletter <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am setting up a server that will be for a B2B business, and I want the<br>
whole site to be served as <a href="https://www.example.com/" target="_blank">https://www.example.com/</a><br>
<br>
I have gotten a certificate and <a href="https://www.example.com" target="_blank">https://www.example.com</a> runs just fine, but<br>
I can't figure out how to require <a href="https://www.example.com" target="_blank">https://www.example.com</a> when a user tries<br>
to go to <a href="https://example.com" target="_blank">https://example.com</a>.<br>
<br>
In reading through the <a href="http://nginx.org" target="_blank">nginx.org</a> site, it seems like rewrites and if<br>
statements are discouraged. I did figure out how to require<br>
<a href="http://www.example.com/" target="_blank">http://www.example.com/</a> by using the following in my server block file:<br>
<br>
server {<br>
listen [::]:80;<br>
server_name <a href="http://example.com" target="_blank">example.com</a> *.<a href="http://example.com" target="_blank">example.com</a>;<br>
return 301 $scheme://<a href="http://www.example.com" target="_blank">www.example.com</a>$request_uri;<br>
}<br>
<br>
But doing something similar for 443 doesn't seem to work.<br>
<br>
Can someone please help me out or point to a good page on setting up for<br>
this?<br>
<br>
Posted at Nginx Forum: <a href="http://forum.nginx.org/read.php?2,237695,237695#msg-237695" target="_blank">http://forum.nginx.org/read.php?2,237695,237695#msg-237695</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div>