# 与上游服务器SSL握手超时

- **ID:** `nginx/ssl-handshake-timeout-upstream`
- **领域:** nginx
- **类别:** timeout_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

上游服务器完成SSL握手过程缓慢，通常由高负载或网络延迟引起。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| nginx 1.18.0 | active | — | — |
| nginx 1.20.2 | active | — | — |
| nginx 1.22.1 | active | — | — |

## 解决方案

1. ```
   在location块中增加proxy_ssl_handshake_timeout：
proxy_ssl_handshake_timeout 30s;
   ```
2. ```
   优化上游SSL配置：启用会话缓存并减少密码协商开销：
proxy_ssl_session_reuse on;
proxy_ssl_ciphers HIGH:!aNULL:!MD5;
   ```

## 无效尝试

- **Increase proxy_read_timeout** — proxy_read_timeout controls reading response body, not SSL handshake timeout. (90% 失败率)
- **Disable SSL verification entirely** — This removes security without addressing the root cause (slow handshake). (60% 失败率)
- **Restart nginx service** — Restarting nginx does not affect upstream SSL handshake speed. (95% 失败率)
