António P. P. Almeida
appa at perusio.net
Tue Feb 8 19:38:33 MSK 2011
On 8 Fev 2011 16h14 WET, david at 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;
More information about the nginx