How to redirect all SSL traffic?

Alex Hunsaker badalex at gmail.com
Mon Nov 9 01:10:46 MSK 2009


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