On 8 Fev 2011 16h14 WET, dav...@styleflare.com wrote:
Wouldn't that create an infinite loop?
No because they're listening on different ports. No need for an
if. Use two server blocks as suggested.
The server block for port 80 always does a permanent redirect do the
the same server but listening on 443 with a SSL socket.
All the page processing happens at the server block for port 443.
## This is to avoid the spurious if for sub-domain name
## rewriting. See http://wiki.nginx.org/Pitfalls#Server_Name.
rewrite ^ https://example.com$request_uri? permanent;
} # server domain rewrite.
listen [::]:443 ssl;
nginx mailing list