nginx 301跳转配置、强制https跳转

#301-START
if ($host ~ '^huixx.cn'){
return 301 https://www.huixx.cn$request_uri;
}
#301-END
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END

  

你不能把坏习惯扔出窗外 但你可以一步步赶下电梯
原文地址:https://www.cnblogs.com/Ychao/p/14558232.html