美文网首页
Nginx 跳转HTTP到HTTPS

Nginx 跳转HTTP到HTTPS

作者: 石头_0c43 | 来源:发表于2018-09-18 07:14 被阅读0次

Syntax

if ($host ~* ^(example\.com|www\.example\.com)$ ){

  rewrite  ^/(.*)$  https://example.com/$1  permanent;

}

OR better use the following rewrite:

rewrite  ^ https://$server_name$request_uri? permanent;

Or use new syntax (recommended):

return        301 https://$server_name$request_uri;

相关文章

网友评论

      本文标题:Nginx 跳转HTTP到HTTPS

      本文链接:https://www.haomeiwen.com/subject/fsmenftx.html