cooc123 发表于 2018-5-8 23:39:46

nginx http to https

[*]server
[*]    {
[*]      listen 80;
[*]      #listen [::]:80;
[*]      server_name www.xxx.com xxx.com;
[*]
[*]      location ~ /.well-known {
[*]            root/data/wwwroot/www.xxx.com;
[*]            allow all;
[*]      }
[*]
[*]      location / {
[*]            rewrite ^/(.*)$ https://www.xxx.com/$1 permanent;
[*]      }
[*]    }复制代码

现在访问 http://www.xxx.com 会跳到https
访问 https://www.xxx.com 还是301
哪出错了

toyst 发表于 2018-5-8 23:40:54

请问你的ssl配置跑哪儿去了?

cooc123 发表于 2018-5-8 23:42:36


toyst 发表于 2018-5-8 23:40

请问你的ssl配置跑哪儿去了?
ssl 没贴出来

只要把 rewrite ^/(.*)$ https://www.xxx.com/$1 permanent; 给注释 Https 访问是正常的
ssl 的server 没有301

rooney 发表于 2018-5-8 23:40:00

前面是不是还加了CDN或者是反向代理?

cooc123 发表于 2018-5-8 23:44:31


rooney 发表于 2018-5-8 23:44

前面是不是还加了CDN或者是反向代理?
cf 的cdn 没有反向代理

rooney 发表于 2018-5-8 23:45:34


cooc123 发表于 2018-5-8 23:45

cf 的cdn 没有反向代理
所以CF的CDN配置的源站是不是用的HTTP?

三思而后折腾 发表于 2018-5-8 23:44:00


cooc123 发表于 2018-5-8 23:45

cf 的cdn 没有反向代理
cf 是不是启用强制 https

cooc123 发表于 2018-5-8 23:46:25


rooney 发表于 2018-5-8 23:46

所以CF的CDN配置的源站是不是用的HTTP?
这个怎么看

xiaoz 发表于 2018-5-8 23:45:00

下面这几行的意思是无论http还是https,只要请求/目录都重定向到https明显有问题。
[*]location / {
[*]            rewrite ^/(.*)$ https://www.xxx.com/$1 permanent;
[*]      }复制代码

墨迹 发表于 2018-5-8 23:46:34

https://www.hs2v.com/forum.php?mod=viewthread&tid=448151
页: [1]
查看完整版本: nginx http to https