我正在尝试将http重定向到https。我将letencrypt用于ssl证书。我的配置看起来像这样
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
server_name example.com www.example.com;
root /var/www/landing;
location /.well-known/ {
root /var/www/;
}
}
当我尝试访问example.com时,出现浏览器错误,提示重定向太多。 http://example.com和https://example.com均发生错误,当我转到http://www.example.com时访问服务器块,因为我被重定向到https://example.com,然后得到上面的错误。 / p>
我该如何解决?
答案 0 :(得分:1)
我做过wget -S https://wellcode.com
之后,我认为问题出在dns上,因此在Cloudflare中,我将SSL更改为full并解决了问题