You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SSL握手报错'Bad Key Share'及生产环境502问题求助

问题:生产环境接入Google Calendar API时出现502错误

我用Python(Django)开发的应用,上游服务器为Gunicorn,后端使用Nginx,2021年部署上线。接入Google Calendar API用于在谷歌日历中存储实例详情,开发环境(本地服务器)测试正常,但生产环境测试时出现502错误。查看nginx.error.log发现以下报错:

2023/08/12 07:08:15 [crit] 1027#1027: *2547 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 164.92.248.255, server: 0.0.0.0:4
<2023/08/12 07:32:04 [error] 6129#6129: *1 upstream prematurely closed connection while reading response header from upstream, client: 101.176.222.32, server: easygoshuttle.com.au, requ>

我已查阅相关资料但未找到可行解决方案,以下是我的Nginx配置:

server_name easygoshuttle.com.au www.easygoshuttle.com.au ;

location = /favicon.ico { access_log off ; log_not_found off ; }
location /static/ {         root /home/ubuntu/github/easygo ;
}

location / {
    include proxy_params;
    proxy_send_timeout 10080;
    proxy_read_timeout 10080;
    proxy_connect_timeout 10080s;
    proxy_request_buffering off;
    proxy_buffering off;
    proxy_redirect off;
    proxy_ssl_server_name on;
    proxy_pass http://unix:/run/gunicorn.sock;
}

listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/easygoshuttle.com.au/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/easygoshuttle.com.au/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.easygoshuttle.com.au) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = easygoshuttle.com.au) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name easygoshuttle.com.au www.easygoshuttle.com.au ;
    return 404; # managed by Certbot
}

内容的提问来源于stack exchange,提问作者Peter Kam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 09:51:01