接受的解决方案不适用于我的设置。我不得不将 if 语句更改为以下内容:
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
Run Code Online (Sandbox Code Playgroud)
如官方 nginx 文档https://www.nginx.com/blog/creating-nginx-rewrite-rules#https 中所述,您应该使用:
return 301 https://$host$request_uri;
Run Code Online (Sandbox Code Playgroud)
这也有效。
| 归档时间: |
|
| 查看次数: |
2016 次 |
| 最近记录: |