首页 > 其他 > 详细

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

时间:2017-02-14 23:07:22      阅读:1209      评论:0      收藏:0      [点我收藏+]

其实很简单:

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;
}


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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!