How to redirect all SSL traffic?

Glen Lumanau glen at lumanau.web.id
Mon Nov 9 04:49:56 MSK 2009


I tried this, but still doesn't works 


-----Original Message-----
From: Alex Hunsaker [mailto:badalex at gmail.com] 
Sent: 09 Nopember 2009 5:11
To: glen at lumanau.web.id
Cc: nginx at sysoev.ru
Subject: Re: How to redirect all SSL traffic?

On Sun, Nov 8, 2009 at 03:31, Glen Lumanau <glen at lumanau.web.id> wrote:

[ please keep the mailing list cc'ed ]

> Try port 80...

>> On port 80 is sucessfull. Is there any way to do that on port 443?

Ahh ok so you want http://mydomain.com and https://mydomain.com to go
to https://www.mydomain.com.

Sure something like:
server {
listen 80;
rewrite (^.*) https://www.mydomain.com$1 permanent;
}

# config for https://www.mydomain.com
server {
 listen 443;
 ...
 if ($host !~ www\.mydomain\.com) {
 rewrite ^(.*) https://www.mydomain.com$1 permanent;
}

}






More information about the nginx mailing list