{
  "id": "nginx/ssl-certificate-verify-failed-self-signed-certificate-in-chain",
  "signature": "SSL: certificate verify failed: self-signed certificate in certificate chain while SSL handshaking to upstream",
  "signature_zh": "SSL：证书验证失败：证书链中存在自签名证书，在与上游进行 SSL 握手时",
  "regex": "SSL: certificate verify failed: self-signed certificate in certificate chain while SSL handshaking to upstream",
  "domain": "nginx",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "Upstream server uses a self-signed certificate or a chain ending in a self-signed root, and nginx proxy_ssl_verify is enabled without the proper CA certificate.",
  "root_cause_type": "generic",
  "root_cause_zh": "上游服务器使用了自签名证书或链以自签名根证书结尾，并且 nginx 启用了 proxy_ssl_verify 但未配置正确的 CA 证书。",
  "versions": [
    {
      "version": "nginx 1.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.20.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.22.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "nginx 1.24.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set proxy_ssl_verify off;",
      "why_fails": "Disabling verification entirely bypasses security; it works but is not recommended for production with sensitive data.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use proxy_ssl_trusted_certificate with the upstream's public certificate only",
      "why_fails": "If the upstream has a full chain, nginx needs the root CA, not just the leaf cert. The leaf cert alone may not establish trust.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Regenerate upstream certificate with same CA",
      "why_fails": "If the CA itself is self-signed and not trusted, regenerating the leaf cert won't fix the trust chain.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Obtain the upstream's self-signed CA certificate and configure proxy_ssl_trusted_certificate with that CA file, then enable proxy_ssl_verify. Example:\nproxy_ssl_trusted_certificate /etc/nginx/ssl/upstream-ca.crt;\nproxy_ssl_verify on;\nproxy_ssl_verify_depth 2;",
      "success_rate": 0.85,
      "how": "Obtain the upstream's self-signed CA certificate and configure proxy_ssl_trusted_certificate with that CA file, then enable proxy_ssl_verify. Example:\nproxy_ssl_trusted_certificate /etc/nginx/ssl/upstream-ca.crt;\nproxy_ssl_verify on;\nproxy_ssl_verify_depth 2;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Replace the upstream's self-signed certificate with one signed by a public CA (e.g., Let's Encrypt). This eliminates the need for custom trust configuration.",
      "success_rate": 0.9,
      "how": "Replace the upstream's self-signed certificate with one signed by a public CA (e.g., Let's Encrypt). This eliminates the need for custom trust configuration.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Obtain the upstream's self-signed CA certificate and configure proxy_ssl_trusted_certificate with that CA file, then enable proxy_ssl_verify. Example:\nproxy_ssl_trusted_certificate /etc/nginx/ssl/upstream-ca.crt;\nproxy_ssl_verify on;\nproxy_ssl_verify_depth 2;",
    "Replace the upstream's self-signed certificate with one signed by a public CA (e.g., Let's Encrypt). This eliminates the need for custom trust configuration."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_verify",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-09-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}