nginx访问http80端口跳转https443端口

时间:2017-02-13 22:20:44   收藏:0   阅读:1371

    在配置文件中加入下面代码

server {

    ...


    if ($server_port = 80){ 

return 301 https://$server_name$request_uri;} 

if ($scheme = http){ 

return 301 https://$server_name$request_uri;} 

error_page 497 https://$server_name$request_uri;

    ....

}

本文出自 “jinchuang” 博客,请务必保留此出处http://jinchuang.blog.51cto.com/8690689/1897391

原文:http://jinchuang.blog.51cto.com/8690689/1897391

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!