if ($scheme = http ) {return 301 https://$host$request_uri;}
或
if ($server_port = 80 ) {return 301 https://$host$request_uri;}
或
if ($ssl_protocol = "") { return 301 https://$server_name$request_uri; }if ($host != www.abc.com) { return 301 $scheme://www.abc.com$request_uri; }
将abc改成你自已域名。
强烈推荐第一种
