gpt4 book ai didi

ssl - Jelastic Nginx http 到 https 重定向

转载 作者:太空宇宙 更新时间:2023-11-03 13:09:34 27 4
gpt4 key购买 nike

我在 Jelastic 中有一个帐户,我想强制我的网站仅在 https 上运行。我已经使用 nginx 平衡器创建了环境 nginx + php 并启用了 Jelastic SSL(正如它所描述的 here )。

每当我尝试设置从 http 到 https 的 301 重定向但没有成功。使用 mod_rewrite 对我不起作用,我唯一得到的是循环重定向。谷歌没有帮助。

我真的需要建议。将提供任何其他信息。

提前致谢。

最佳答案

可接受的解决方案不适用于我的设置。我不得不将 if 语句更改为以下内容:

if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}

如官方 nginx 文档所述https://www.nginx.com/blog/creating-nginx-rewrite-rules#https你应该使用:

return 301 https://$host$request_uri;

同样有效。

关于ssl - Jelastic Nginx http 到 https 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37370280/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com