redirect from http to https

Grzegorz Nosek grzegorz.nosek at gmail.com
Mon Mar 9 01:43:42 MSK 2009


On Sun, Mar 08, 2009 at 09:28:46PM +0100, Steve Zhuo wrote:
> Hi
> 
> I'm trying to redirect all income request from http to https:  i've
> tried the rewrite module , but i always got the redirect in a loop
> issue. please help.

You need to enable SSL on port 443.

> 
> server {
>         listen       80;
>         server_name  www.domain.com domain.com;
>        rewrite     ^(.*)  https://$server_name$1 permanent;
> 
>        '''''''
>        }
> 
>  server {
>         listen       443;
>         server_name  www.domain.com domain.com;

+	  ssl_certificate /path/to/server.crt;
+	  ssl_certificate_key /path/to/server.key;
+	  ssl on;

>         .....
>         }

Best regards,
 Grzegorz Nosek (replying by diffs is fun! ;))





More information about the nginx mailing list