nginx 非80、443端口跳转到80、443

时间:2017-02-14 23:07:22   收藏:0   阅读:1209

其实很简单:

if ($server_port != ‘80‘ ) {
   rewrite ^/(.*)$ http://$host/$1 permanent;
}

举一反三。。。

if ($server_port != ‘443‘ ) {
   rewrite ^/(.*)$ https://$host/$1 permanent;
}
if ($host != ‘host‘ ) {
   rewrite ^/(.*)$ http://host/$1 permanent;
}


原文:http://314258.blog.51cto.com/304258/1897476

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