跳到主要内容
ecdsa.com
Chrome, Edge and other Chromium browsers浏览器

错误信息

net::ERR_CERT_COMMON_NAME_INVALID

警告页显示“NET::ERR_CERT_COMMON_NAME_INVALID”;自动化工具打印的是“net::ERR_CERT_COMMON_NAME_INVALID”。

Chrome, Edge and other Chromium browsers — the certificate does not cover the host name in the address bar

含义

证书受信任且在有效期内,但地址栏中的主机名不在它的主题备用名称(SAN)中。尽管错误名称如此,Chrome 根本不使用通用名称(从 Chrome 58 起);证书必须在 subjectAltName 中列出该主机。典型情况:www 与裸域名不一致、新增的子域名,或者通配符用在了深一级的子域名上。

原因

修复方法

  1. 1.

    将 SAN 列表与地址比对

    缺少的那个名称就是需要添加的名称。

    bash
    echo | openssl s_client -connect www.example.com:443 -servername www.example.com 2>/dev/null \
      | openssl x509 -noout -ext subjectAltName
  2. 2.

    重新签发证书,列出你提供服务的所有名称

    包含裸域名、www 和所有子域名(或每一级各用一个通配符)。

    bash
    # Cover the apex and www (and any subdomain you serve)
    sudo certbot certonly --nginx -d example.com -d www.example.com
  3. 3.

    检查每个名称得到的是哪张证书

    在共享服务器上,没有独立 server 块的名称会收到另一个网站的默认证书。

    text
    # nginx: every served name needs a server block with a matching certificate
    server {
        listen 443 ssl;
        server_name example.com www.example.com;
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    }

相关错误

浏览完整的签名错误库