使用让我们使用CloudFlare和nginx加密时,SSL握手失败

在尝试创建Let's Encrypt SSL证书后尝试访问我的网站时,我很不幸地在cloudflare上获得了525 SSL handshake failed错误。

我通过运行certbot-auto certonly然后输入我的电子邮件,域和webroot来生成证书。 然后我将证书文件添加到我的服务器块中,如下所示。

以下是相关的nginx服务器块:

server {
    listen 80;
    server_name mydomain.com www.mydomain.com;
    return 301 https://$host$request_uri;
}
server {
    listen 443 ssl;
    server_name mydomain.com www.mydomain.com;

    ssl_certificate         /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/mydomain.com/privkey.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/ssl/certs/dhparam.pem;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-G$
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security max-age=15768000;

    root /var/www/html/mydomain.com;
    autoindex on;
    index index.php index.html index.htm;
    location ~ .php$ {
            fastcgi_index index.php;
            fastcgi_pass 127.0.0.1:9000;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /.well-known {
            allow all;
    }
}

ls -l /etc/letsencrypt/live/mydomain.com的输出如果很重要:

total 4
-rw-r--r-- 1 root root 543 Jan 13 12:44 README
lrwxrwxrwx 1 root root  41 Jan 13 13:14 cert.pem -> ../../archive/mydomain.com/cert3.pem
lrwxrwxrwx 1 root root  42 Jan 13 13:14 chain.pem -> ../../archive/mydomain.com/chain3.pem
lrwxrwxrwx 1 root root  46 Jan 13 13:14 fullchain.pem -> ../../archive/mydomain.com/fullchain3.pem
lrwxrwxrwx 1 root root  44 Jan 13 13:14 privkey.pem -> ../../archive/mydomain.com/privkey3.pem

运行nginx -t不会出错。

我的CloudFlare设置:

SSL - 全面(严格)

链接地址: http://www.djcxy.com/p/32475.html

上一篇: 525 SSL handshake failed when using Let's Encrypt with CloudFlare and nginx

下一篇: Disable SSL in cloudflare and using in server side (Ubuntu and Nginx)