![SSL 不起作用](https://linux22.com/image/1590920/SSL%20%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
我在 aws ec2 实例上有一个 nginx 服务器。我已成功在 nginx 中设置了 SSL 并配置了 SSL。如果我使用以下网站检查我的 SSL 设置:
https://whynopadlock.com https://www.sslshopper.com/ssl-checker.html
我可以看到 SSL 工作正常,但是当我在浏览器上打开网站时https://example.com 它会自动重定向到 example.com
这是我的配置:
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
keepalive_timeout 70;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
ssl_certificate /etc/letsencrypt/live/example.tk/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.tk/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.tk/chain.pem;
ssl_session_timeout 10m;
server_name example.tk;
# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name .example.tk;
location / {
return 301 https://example.tk$request_uri;
}
我在这里做错了什么?